Forum Moderators: coopster
if (isset ($_POST['submit']))
{
$fp = fopen("../../header.htm", "w" ) or die("Couldn't open $filename");
fwrite( $fp,"
echo '{$_POST['content']}';
" );
fclose( $fp );
print "Writing Main File Complete <br>";
}
else
{
$textarea = file_get_contents("../../header.htm");
}
?>
<h2>Edit Header Page</h2>
<form action="pupilheader.php" method="post">
<p>Desc:<br /> <textarea name="content" cols="100" rows="20"><?echo $textarea;?></textarea></p>
<input type="submit" name="submit" value="Edit The Header" />
</form>
is my code
and that works but when i put html in my code every " and ' gets a \ and it messes up the page... how would i work around this
if (isset ($_POST['submit']))
{
$fp = fopen("../../header.htm", "w" ) or die("Couldn't open $filename");
fwrite( $fp,"
echo stripslashes('{$_POST['content']}');
" );
fclose( $fp );
print "Writing Main File Complete <br>";
}
else
{
$textarea = file_get_contents("../../header.htm");
}
?>
<h2>Edit Header Page</h2>
<form action="pupilheader.php" method="post">
<p>Desc:<br /> <textarea name="content" cols="100" rows="20"><?echo $textarea;?></textarea></p>
<input type="submit" name="submit" value="Edit The Header" />
</form>
it doesnt work
Use stripslashes when you need to retrieve the contents from the file:
$textarea = file_get_contents("../../header.htm");
$textarea = stripslashes($textarea);