i am making a news updator for my friends website, every time you post the form it returns to the form, can you help? what do i need to change?
heres the code:
<head>
<title>Le Garagiste - News Updater</title>
<LINK REL="stylesheet" TYPE="text/css" HREF="include/legstyle.css">
<?
// Reset link. Don't touch the following crap.
$error = "";
if (!empty($send)){ // If the user didn't fill out the form yet, show them the form.
if ($subject != ""){ // NAME field. If the person posting left SUBJECT blank, don't post.
if ($message != ""){ // MESSAGE field. If the person posting left MESSAGE blank, don't post.
if ($date != ""){ // DATE field.
// This is the file where the message will be posted. It is an ABSOLUTE SERVER PATH. If you don't know your server path, ask your host. HTTP:// will NOT work in this line. C:/PATH will.
$log_file = "include/newsmsg.inc";
// Delete all "\" characters in MESSAGE. If this is not here, then there will be a "\" character before all quote characters.
$message = stripslashes($message);
// Disables HTML in MESSAGE.
$message = str_replace ("<","<", $message);
$message = str_replace (">",">", $message);
// Same with message, only deletes slashes from SUBJECT field.
$name = stripslashes($subject);
// Disables HTML in NAME.
$name = str_replace ("<","<", $subject);
$name = str_replace (">",">", $subject);
// Same with message, only deletes slashes from date field.
$name = stripslashes($date);
// Disables HTML in date.
$name = str_replace ("<","<", $date);
$name = str_replace (">",">", $date);
// This is the value that is added to the log file. ADD A \ CHARACTER IN FRONT OF ALL QUOTE CHARACTERS, EXCEPT FOR END.
$to_log = "
<font class=\"datecount\" size=2>
<p>$posttype - $subject</p>
<p>$message</p>
<p>Posted on: $date<p>
</font>
<hr>
";
// Write the contents to the file. This is where $TO_LOG is added to $LOG_FILE
$fp = fopen($log_file, "w");
$fw = fwrite($fp, $to_log);
fclose($fp);
// Error messages.
} else { $error = "No message given."; }
} else { $error = "No name given."; }
} else { $error = "No date given."; }
}
// The rest of the code is the HTML part, you should know how to fix it. DONT MESS IT UP.
?>
</head>
<BODY BGCOLOR="#d0d0d0" TEXT="#000000">
<font class="datecount" size="2">
<p>
<img src="imgs/newsup_log.jpg">
</p>
<ul>
<?
if (!empty($send)){
if (!empty($error)){
print "$error";
} else {
print "Your update has been posted. To see this message refresh the 'Le Garagiste' News section.";
}
} else {
?>
<form action="nupdate2.phtml" method="post">
Category:<br>
<select name="posttype">
<option value="For Sale" selected>For Sale</option>
<option value="Working On">Working On</option>
<option value="Looking For">Looking For</option>
<option value="Thinking About">Thinking About</option>
<option value="Technical Stuff">Techical Stuff</option>
</select>
</p>
<p>
Date:<br>
<input type="text" value="<?php echo gmdate("jS F Y"); ?>" name="date" size="15">
</p>
<p>
Subject:<br>
<input type="text" name="subject" size="30" maxlength="100">
</p>
<p>
Message:<br>
<textarea name="message" rows="7" cols="30"></textarea>
</p>
</font>
<font color="#d0d0d0">
<p>
<input type="submit" value="Sumbit Update"> * <input type="reset" value="Reset Form">
<?
}
?>
</FORM>
</ul>
</BODY>
End of code, please help! Max Slade