<?php
$saving = $_REQUEST['saving'];
if ($saving == 1){
$data = $_POST['data'];
$file = "data.txt";
$fp = fopen($file, "a") or die("Couldn't open $file for writing!");
fwrite($fp, $data) or die("Couldn't write values to file!");
fclose($fp);
echo "Saved to $file successfully!";
}
?>