Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: fopen, fclose, fwrite....

  1. #1
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation fopen, fclose, fwrite....

    Hello ,

    I am a total begginer to PHP and need to know about the functions in the title - fopen, fclose, fwrite (and if there are more then them to) and why does it have f in front of it


    And just one more thing

    How do set PHP to start itself only when something has been clicked for a example a button ?

  2. #2
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Please tell me

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    How do set PHP to start itself only when something has been clicked for a example a button ?
    Don't send the request until the button is clicked.
    I am a total begginer to PHP and need to know about the functions in the title - fopen, fclose, fwrite (and if there are more then them to) and why does it have f in front of it
    Because it deals with files. They mimic the C functions.

    Other than what's in the PHP docs (which I'm going to optimistically assume you've read), there's not really much more to them. You open a file with fopen(), read/write from it with fread()/fwrite(), then close it with fclose().
    Please tell me
    Patience is a virtue.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I understand completely the f functions but stll i do not get the don't send the request untl the button is clicked part.

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    <form action="dosomething.php">
      <input type="submit" value="Do Something">
    </form>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks ,

    I understand that now but one thing still haunts me... How would you simply stop PHP i mean in javascript you would do somthing like this -

    <button id="id" onclick="asd()">Corck</button>
    <script type="thetype">
    function asd() {
    the scripts
    }
    </script>

    so the function part stops the scriipt from running if the button has not been clicked. but if you do that form thing the php script still has not function thing over it to stop it and how do you even asihn php a function name like asd().

    Please give an example with php having an function name asined to it plus a button which is clicked for the php art to activate.

  7. #7
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Please can you give me an example of the above ?

  8. #8
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    You have to understand that PHP does not interact with the DOM, or dynamically change things on the page.

    As Twey posted, you would have to send the request to a page to change the data using <form>.
    - Mike

  9. #9
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well may i please have an example ? ,

    Plus can javascript read/write/open/close files and can it also run php within it self like this -

    <button onclick="asd()">Test</button>
    <script>
    function asd() {
    <?php
    echo "You fool !"
    ?>
    }
    </script>

    Well can it ?

  10. #10
    Join Date
    Feb 2007
    Location
    Earth
    Posts
    133
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default

    test it in wamp... im pretty sure it will work but not 100&#37;
    http://www.insanecombat.com << bored? check out ma game

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •