I need to be able to save form data to a .txt file with php. I have three variables. $title, $description, and $content. I need to save them to the .txt file, and be able to open that .txt file with php and use all three of the variables.
i think he is asking about how to write in a file not to sort or serialize please check this :http://au2.php.net/manual/en/function.fwrite.php
filename = 'test.txt'; $content = serialize(array('title' => $title, 'description' => $description, 'content' => $content)); if (is_writable($filename)) { if (!$handle = fopen($filename, 'w')) { echo "Cannot open file ($filename)"; exit; } if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success, wrote to file ($filename)"; fclose($handle); } else { echo "The file $filename is not writable"; } PHP: To unserialize, you simply do: $arr = unserialize(file_get_contents($filename)); $title = $arr['title']; //etc.. PHP:
Its a simple task. You have to just write those variables to a txt file with delimiter like comma,tab etc. You can easily find code to write to a file. In case you need further help, you can get in touch with me.