PHP Basics In Pictures
Append to files
  1. Create a new script with this code:

    <title>Append to files</title>


    <h2>Add to Today's Thought</h2>

    <p><b>Today's Thought is ...</b></p>

    $myfile = fopen ('textthought.txt', 'r') or die ("Can not open file");

    while (!feof($myfile)){
    $line = fgets($myfile,4096);
    print "$line <br>";
    ?> <form action="textappender.php" method="post">

    <input type="hidden" name="filename" value="textthought.txt">

    <b>Write what you want to add here ... </b><br>

    <textarea name="comments" rows="3" cols="50" wrap></textarea>

    <input type="submit" value="Update Thought" name="submit">


  2. Save the script as textappenderform.php in the PHPSCRIPTS folder.

    Then upload it to the home directory in your Web site.