Forum Moderators: coopster
I am currently building a rather simple form and I was wondering if someone could help me write or find a script to do what I need.
Here is what I am trying to accomplish. I have a form with about 50 fields, and when someone clicks submit I need two things to happen. I need the information sent by e-mail to a designated (specified in the script) e-mail address and a copy to be saved on the server. (So that our windows clients can later access it via a samba share.
I am not a php programmer but I believe the top can be done, but I also need a couple more things to happen. I need to be able to setup how the email is sent. It will be containing a lot of information (im sure this possible as well!). Basically I just want it to display the information that was written in the fields neatly so someone can read it. And, the good news is, the e-mail that is produced is exactly what I need saved on the server. I just need it to use one of the text fields (variable) as the file name, I am hoping I can save them as .txt files or even .html files.
If anyone could provide any assistance I would be greatful!
Thanks,
- Lenny
PHP has an email function built-in:
mail($emailaddy, $subject, $message, $headers); I don't do file writing very often, but to write it to a file, you'd do something like this:
// $filename is the variable with the name of the file
$fp = fopen("$filename.txt","w");
fwrite($fp, $message);
fclose($fp);