Hello, I am VERY new to php and i probably missing something stupid.
I was trying to write some code to let visitor of my site to submit text information from <form> and to let that info be displayed on the same page bellow. The code is working great on my PC but it keeps erroring me on the server.
I'd really appreciate if someone could check the code for a possible errors.
The form (on guestbook.php page):
<center>
<form action="commentsdata.php" name="data" method="post">
Name:<br />
<input type="text" class="textfield" name="name" /><br />
Message:<br />
<textarea class="textarea" name="message"></textarea><br />
<input type="reset" value="Reset" /> <input type="submit" value="Post" />
</form>
<p class="pack">You can use standart <i>html</i> tags in the message window.<br /> <small>(This may cause the page validation to fail).</small></p>
</center>
<br />
<h1><img src="arrow.gif" alt="" />The messages:</h1>
<?php include ("massages.html"); ?>
The form action (commentsdata.php):
<?php
$data = "<p><b>From:</b><br /> ".$_POST['name']."<br />";
$data = $data."<b>Message:</b><br /> ".$_POST['message']."</p><hr />";
$file = "massages.html";
if (!$file_handle = fopen($file,"a+")) { echo "Cannot open file"; }
if (!fwrite($file_handle,$data)) { echo "Cannot write to file"; }
echo ('<meta http-equiv="Refresh" content="0;url=posted.html" />');
fclose($file_handle);
echo ('<meta http-equiv="Refresh" content="5;url=guestbook.php" />');
?>
Thank you very much,
Sasha