crewebiker
09-04-2007, 11:58 PM
i've came up with the following script for an 'easy' write to file from form page.
i've done it a few times before with success, but for some strange reason this time i'm having a bit of trouble with the variable 'page' coming up undefined. It's probably something really simple but i can't seem to be able to spot it.
if (isset($_POST['update'])){
$file = fopen('db/pages/home.php', 'a', 1);
fwrite($file, $page);
fclose($file);
}
else {
$lines = file('db/pages/home.php');
$l_count = count($lines);
for($x = 0; $x< $l_count; $x++)
{
}
echo "<form method=\"post\" name=\"update\" enctype=\"multipart/form-data\" action=\"?page=admin&mode=edit\">";
echo "<textarea name=\"page\" cols=\"80\" rows=\"8\">".$lines[5]."</textarea>";
echo "<input type=\"Submit\" name=\"update\" value=\"Update\"></form>";}
}
Any help would be greatly appreciated, thanks.
i've done it a few times before with success, but for some strange reason this time i'm having a bit of trouble with the variable 'page' coming up undefined. It's probably something really simple but i can't seem to be able to spot it.
if (isset($_POST['update'])){
$file = fopen('db/pages/home.php', 'a', 1);
fwrite($file, $page);
fclose($file);
}
else {
$lines = file('db/pages/home.php');
$l_count = count($lines);
for($x = 0; $x< $l_count; $x++)
{
}
echo "<form method=\"post\" name=\"update\" enctype=\"multipart/form-data\" action=\"?page=admin&mode=edit\">";
echo "<textarea name=\"page\" cols=\"80\" rows=\"8\">".$lines[5]."</textarea>";
echo "<input type=\"Submit\" name=\"update\" value=\"Update\"></form>";}
}
Any help would be greatly appreciated, thanks.