Hello,
I'm trying to create a small comments page for my website, the comments would be stored to a text document. So far I have them storing but each entry overwrites the other one. I know that by putting in a /n I could place eack comment on a new line, trouble is I'm not sure where to put it!
My Code So Far...
Comments.php
<?php
$myFile = "texts/comments.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, 710);
fclose($fh);
echo $theData;
?>
</p>
</div>
<p><strong>Post Comments Here </strong></p>
<FORM method="POST" action="process.php">
<p>
<textarea name="text" cols="50" rows="10"></textarea>
</p>
<p>
<INPUT type="submit" name="submit" value="submit"></p>
</FORM>
The above code is for my form and opening the text file for viewing...
Process.php
<?
$fn = "texts/comments.txt";
$content = stripslashes($_POST['text']);
$fp = fopen($fn,"w") or die ("Error opening file in write mode!");
fputs($fp,$content);
fclose($fp) or die ("Error closing file!");
echo "<meta http-equiv=\"refresh\" content=\"0; url=comments.php\" />\n";
?>
Above is the code that should store new entries in the text document...
Thanks in advance for any help!