Im using the following php to send the contents of an HTML <form> to a text file:
$filename = "polls"."/".time() .'.txt';
if (isset($_POST["submitwrite"])) {
$handle = fopen($filename,"w+");
if ($handle) {
fwrite($handle, $_POST["username"]."¬".$_POST["pollname"]."¬".$_POST["ans1"]."¬".$_POST["ans2"]."¬".$_POST["ans3"]."¬".time());
fclose($handle);
}
At the same time as creating the text file, with the contents of the form, I also want to write the time() to a file which already exists, So will use ‘a+’. They will need to be stored as comma seperated values.
Can anyone suggest how I can do this at the same time?
Just open two files: