I made a html editor for my website. It does the following:
- on form1.php, it gets the html code of demopage.html and shows it in a textarea (this works fine)
- the user changes it and clicks submit which brings you to form2.php
- on form2.php, the data that entered in the textarea is put into a variable($new). But when i try to save it to a demopage.html, it only saves it as a blank page with no content: here is my code::::
<?php
$new= $_POST['newpage'];
echo "New Page Will Contain:";
echo "$new";
echo"<br>";
/* Checks if the mod set a vaue */
if ($new==""){
echo "<h1>Error</h1>";
echo "You must enter something to show as the new page";
}
/*Sets the new value */
else
$handle = fopen("../../../settings/demopage.html", 'w+');
if($handle)
{
if(!fwrite($handle, $new))
die("Error, Couldnt Save New Page To File");
echo "Succedd:";
}
?>
What is wrong???
- on form1.php, it gets the html code of demopage.html and shows it in a textarea (this works fine)
- the user changes it and clicks submit which brings you to form2.php
- on form2.php, the data that entered in the textarea is put into a variable($new). But when i try to save it to a demopage.html, it only saves it as a blank page with no content: here is my code::::
<?php
$new= $_POST['newpage'];
echo "New Page Will Contain:";
echo "$new";
echo"<br>";
/* Checks if the mod set a vaue */
if ($new==""){
echo "<h1>Error</h1>";
echo "You must enter something to show as the new page";
}
/*Sets the new value */
else
$handle = fopen("../../../settings/demopage.html", 'w+');
if($handle)
{
if(!fwrite($handle, $new))
die("Error, Couldnt Save New Page To File");
echo "Succedd:";
}
?>
What is wrong???