Could someone pleeease tell me why this is not working:
<? if ($_POST["submit"])
{
if ($_POST["name"] == "")
echo "Error: No name given.";
else if ($_POST["text"] == "")
echo "Error: No message.";
else
{
if (($file2 = fopen("gb.dat", "a")) === FALSE)
echo "oops";
else
{
$name = $_POST["name"];
$name = strip_tags($name);
$mail = $_POST["mail"];
$mail = strip_tags($mail);
$text = $_POST["text"];
$text = strip_tags($text);
$text = str_replace("\n",$text);
fwrite($file2, time() . "\n");
fwrite($file2, $name . "\n");
fwrite($file2, $mail . "\n");
fwrite($file2, $text . "\n");
fclose ($file2);
}
}
}
$file = file("gb.dat");
$lines = 0;
if ($file)
$lines = count($file)-1;
if ($lines)
for ($i = $lines ; $i > 0 ; $i-=4)
{
$time = $file[ $i - 3 ];
$name = $file[ $i - 2 ];
$mail = $file[ $i - 1 ];
$text = $file[ $i ];
echo '
<tr>
<center><td width="100" align="left" valign="top">
<font face="Arial" color="#000000" size="1">
'. date("H:i",$time) .'
<br>
'. date("Y-m-d",$time) .'
<br>
<a href="mailto:'. $mail.'
" style=".style1">
<font color="#000000">
'.$name.'
</font></a></font></td>
<td width="150" valign="top"><font size="1" color="#000000">
'.$text.'
</font></td></center>
</tr>
<tr>
<td width="350" height="10" valign="top" colspan="2">
<hr color="#000000" align="left" size="1">
<br>
</td>
';
}
?>
I get a Notice Undefined Index: submit
when i load the script, and it doesnt add any information to the dat file