Thanks. Yes, I want it to display & as that is what is in the file from which it gets its input.
I'm just learning PHP and simply cannot figure this out. Here's the relevant code:
- Code: Select all
if (isset($_POST['content'])) {
$content = stripslashes($_POST['content']);
$fh = fopen($fspec,"w") or die ("Error opening file in write mode");
fputs($fh,$content);
fclose($fh) or die ("Error closing file");
echo "Saved";
}
?>
<form action="<?php echo $_SERVER["PHP_SELF"].'?q='.base64_encode($fspec); ?>" method="post">
<div><textarea rows="25" cols="75" name="content"><?php htmlspecialchars(readfile($fspec)); ?></textarea></div>
<div><input type="submit" value="Save" /></div>
</form>
Basically, I just want to display in textarea EXACTLY what is in the file, and save it EXACTLY as entered there...with no conversions taking place anywhere.
I think I've tried all combinations of htmlspecialchars in both reading and writing the file, and it keeps making conversions somewhere. If I use it during the file write, it converts the < and > which I do not want.
Grrrrr...I must be missing something obvious.
Basically, I just want to display in textarea EXACTLY what is in the file, and save it EXACTLY as entered there...with no conversions taking place anywhere.