Hi Everyone,
I am new to PHP..
I created a form that I would like to save to a file like a .txt files or .csv file.
Is this possible with PHP?? If so how?? I tried searching google but did not find anything.
Thanks
Ralph
PHP Saving to a File
Moderator: General Moderators
Yes, take a look in the manual at some of the file functions. Start with fopen().
If you want to avoid the headache of storing data in flatfiles, you might consider working with SQLite or MySQL. Depending on your specific application, of course.
If you want to avoid the headache of storing data in flatfiles, you might consider working with SQLite or MySQL. Depending on your specific application, of course.
Perform this:
Hope this may help You
Code: Select all
$file .= "";
$file .= "<?php";
$file .= "//php contents goes here.. ";
$file .= "?>";
$fs = @fopen("$savepath/" . $filename . '.php', 'w+t');
@fwrite($fs, $file);
@fclose($fs);