HTML/PHP Form Processing Codes to save inputs to text file?

BrightS

New member
How can i create an html form and a php file that capture first and last name and e-mail of website visitors and save it to a text file in the same server directory
then redirect the visitor to an html "thank you" page.

but i need to achieve this with few conditions:

1. when i reload the html form again i want it to show blank/empty fields again and not save previous input (because i tried a code before and it save the old input)

2. i need to put the php file in a remote server not local one and it just process the input/output and send output text file back to the other server.

3. i need it to not erase the old saved value in the text files,
maybe using \n for a new line in the fwrite function? but i don't know how to use it, besides not erasing the old value like i said.

Thank you very much



Thank you
 
I'd advise using MySQL database to store your data. If you really need it in a text file then your looking at having to, when your in the process of writing the data to the file, you have to store all previous data in a variable or array or something then write the new information then rewrite the old information so it's going in chronological order. I did that before I knew how to use MySQL.

There's no HTML form that will store the data there has to be javascript or PHP behind it, chances are it was your computers/browsers cookies that was storing your information.
 
Back
Top