Why cant i save the form?
Posted: Sun Oct 19, 2008 6:48 am
I´m trying to build an function that opens a page to edit in a form, but im totaly stuck now. I will try to open it with GET-command, and it worked, but after editing i cant save it. Can you see what the problem is?
Code: Select all
<?php
$filename = $_GET["page"];
$content = '';
$msg = '';
if (isset($_POST['submitbtn']))
$msg = (file_put_contents($filename,$_POST['content'])) ? "Saved successfully!" : "Error saving content";
if (file_exists($filename))
$content = file_get_contents($filename);
?>
<?=$msg?>
<form method="post" action="page.php">
<textarea name="content" cols=58 rows=20><?=$content?></textarea>
<input type="submit" value="Save" name="submitbtn">
</form>
</td>