Hi,
This is about HMTL, PHP and the update of a txt file.
- Here is the really simple HTML source code I'm using:
<FORM Action = "test.php" METHOD = "post">
<B>Your Name:</B> <INPUT TYPE = "text" NAME = "customerName" /> <BR />
<INPUT TYPE = "submit" NAME = "submit" VALUE = "Submit Form"/> <BR />
</FORM>
It allowed the visitor of the page to submit his/her name.
- Here is the really simple PHP source code I'm using:
<?PHP
$box = $_POST['customerName'];
$fp = fopen ('test', "w+");
fputs( $fp, $box );
fclose( $fp );
?>
This code writes in this file the value of the variable $box.
This works perfectly.
But the problem is that every time there is an entry via the HTML page, the content of the txt file is totaly erased and replaced by the new (latest) entry.
How can I do to save all the entries in the same txt file, each one on a different line ?
Could you please give me some help.
Cheers,
Hugues.