EOT; } if ($_POST['submit']) { // save to file file_put_contents($file_name, $_POST['filestring']); } else { // assuming this is a GET request // get contents of file $file_contents = file_get_contents($file_name); // display form display_form($file_contents); } ?>