<?php
// -- File Replace --
if($form_submit == 1) {
$fp = fopen("your_file.txt","w+");
$fput = fputs($fp,$new_string);
if($fput) {
print "File updated";
} else {
print "File not updated, try again";
}
fclose($fp);
}
// -- Open and read file --
$fp = fopen("your_file","r");
$read = file("your_file.txt");
$string = $read[0];
?>
<!-- HTML CODE -->
<form>
<textarea name="new_string"><?php print $string; ?></textarea>
</form>
<!-- CODE END -->
Read these:
http://www.php.net/manual/en/function.fopen.php
http://www.php.net/manual/en/function.fputs.php
http://www.php.net/manual/en/function.file.php