JamesGecko
Programmer
I have this simple 'edit this page' script that won't work. I don't know why. I have tested the first two modules of code and they seem to work without any problem.
<?php
print "<h2>Edit this page</h2><p>";
//load up the text
$fp = fopen("./pinboard.txt", "r");
$content = fread($fp, filesize('./pinboard.txt'));
fclose($fp);
print "<pre>$content</pre><p>";
if (isset($_POST[content])) {
//write back the text
$fp = fopen("./pinboard.txt","w");
fwrite($fp, $_POST[content]);
fclose($fp);
}
//get a text box up for input
<form action=$_SERVER['PHP_SELF'] method=POST>
print "<textarea rows=5 cols=20 name=content wrap=physical>Text</textarea><br>";
<input type=submit>
</form>
?>
<?php
print "<h2>Edit this page</h2><p>";
//load up the text
$fp = fopen("./pinboard.txt", "r");
$content = fread($fp, filesize('./pinboard.txt'));
fclose($fp);
print "<pre>$content</pre><p>";
if (isset($_POST[content])) {
//write back the text
$fp = fopen("./pinboard.txt","w");
fwrite($fp, $_POST[content]);
fclose($fp);
}
//get a text box up for input
<form action=$_SERVER['PHP_SELF'] method=POST>
print "<textarea rows=5 cols=20 name=content wrap=physical>Text</textarea><br>";
<input type=submit>
</form>
?>