QUOTE
(Code boxes don't have color.)
PHP
Form
<html>
<head>
<title>Comment</title>
</head>
<body>
<?php
$Name = "";
$Comment = "";
$Read = "";
$Write = "";
$Filename = "Data/UIComments.txt";
$File = "";
function ReadComments()
{
global $Read, $File, $Filename;
$File = fopen( $Filename, "r" );
rewind( $File );
$Read = fread( $File, filesize( $Filename ) );
fclose( $File );
}
function WriteComment()
{
global $Read, $Write, $File, $Filename;
$Read .= $Write;
$File = fopen( $Filename, "w" );
rewind( $File );
fwrite( $File, $Read );
fclose( $File );
}
if( @$_POST['name'] and @$_POST['comment'] )
{
$Name = $_POST['name'];
$Comment = $_POST['comment'];
$Write = "\n<span style=\"color: RGB( 128, 0, 128 )\"><nobr>" . $Name . "</nobr></span><span style=\"color: RGB( 192, 192, 192 )\"><nobr>:</nobr></span> " . "<span style=\"color: RGB( 0, 0, 128 )\"><nobr>" . $Comment . "</nobr></span>";
ReadComments();
WriteComment();
}
else
{
ReadComments();
}
echo "<pre style=\"font: 10pt courier new\">" . $Read . "</pre><br />";
?>
<form action="UIComment.php" method="post">
<pre style="color: RGB( 128, 0, 128 ); font: 10pt courier new">Name<span style="color: RGB( 192, 192, 192 )"><nobr>:</nobr></span> <input type="text" name="name" value="" /></pre>
<pre style="color: RGB( 0, 0, 128 ); font: 10pt courier new">Comment<span style="color: RGB( 192, 192, 192 )"><nobr>:</nobr></span> <input type="text" name="comment" value="" /></pre>
<input type="submit" value="Submit" />
</form>
</body>
</html>
That's how my code is now. Everything works perfect, except when I submit and then refresh it says there's some POSTDATA and when I click okay it puts the message in again. So, after I've gotten the POSTDATA, is there anyway to clear the POSTDATA that keeps ( @$_POST['name'] and @$_POST['comment'] ) from evaluating to true when you refresh?