I am writing a guestbook script and I have had to working by using the write command to a text file but when you view the entries all you get is something looking like this..
Name: Adam Gajic, E-Mail: adam@html-source.net, Comment(s): Very nice site
What I want to do is put that into HTML but when I have tried writing HTML to a text file it just throws it back as a parse error.
This is the file..
<?php
$filename = "entries.txt";
$handle = fopen($filename,'a');
$string = "Name: $name, E-Mail: $email, Comment(s): $comments";
fputs($handle, $string);
fclose($handle);
?>
<?php
include("header.inc");
?>
Thank you for signing my guestbook!<br><br>
<a href="view.php3">View Entries</a>
<?php
include("footer.inc");
?>
I have tried as much as I can think of, I have tried using a .html extension instead of .txt but that doesn't work. I have tried putting the HTML inside of the $string variable. Just to make my book look a little more smart I have even tried putting line spacings by pressing enter lol, that don't work.
The view.php3 page is just includes, header.inc, entries.txt, footer.inc
Can someone please tell me how to get my guestbook thing to accept the HTML that I put into the text file because it just looks a mess!
Thanks.
Adam