QUOTE(mandos @ Mar 25 2006, 10:58 PM)

$fh = fopen('myfile.txt.', 'r+');
fwrite($fh, "mynewcontent");
That is of little use to him.
Is too late to be coding for me so here's a quick guide:
1) Open the file you wish to edit using php file functions (fread)
2) Use str_replace to replace & with &, < with < and > with > (if you are editing HTML)
3) Put that replaced string in a textarea
4) Process the form, and use php file functions (fwrite) to write the contents of that form to the file you wish to edit.
Edit: Actually, here's a very quick (and unsafe) guide as to how do it:
CODE
<?php
$file = "me.html";
if (!isset($_POST['submit']))
{
$fo = fopen($file, "r");
$fr = fread($fo, filesize($file));
$fr = str_replace("&", "&", $fr);
$fr = str_replace("<", "<", $fr);
$fr = str_replace(">", ">", $fr);
echo "<form method='post' action='{$_SERVER['PHP_SELF']}'>
<textarea name='newfile' rows='10' cols='50'>{$fr}</textarea>
<br />
<input type='submit' name='submit' value='Submit' />
</form>";
fclose($fo);
}
else
{
$fo = fopen($file, "w");
$fw = fwrite($fo, $_POST['newfile']);
fclose($fo);
}
?>
Should all be pretty self explanatory