Page 1 of 1

Multiple Step Function

Posted: Tue Jun 08, 2004 10:43 pm
by palmere
I'm setting up an extremely simple CMS system that just writes to a text file on submission. The only problem is, if the update file is executed as it stands now, the $_POST['content'] variable is empty and it effectively deletes the content of the text file. Any Ideas?

Code: Select all

<?

$fn = "update.txt";
$content = stripslashes($_POST['content']);
$fp = fopen($fn,"w") or die ("Error opening file in write mode!");
fputs($fp,$content);
fclose($fp) or die ("Error closing file!");
echo "<meta http-equiv="refresh" content="0; url=../" />\n";

?>
Thanks much.

E

Posted: Tue Jun 08, 2004 10:49 pm
by feyd

Code: Select all

if(!empty($_POST['content']))
{
// your code here
}
?

Posted: Tue Jun 08, 2004 11:08 pm
by palmere
Thanks much. Spotless.