Sunday, August 2, 2009

How do I send data from a form in a website to a certain email add using PHP script?

This is for our school project, wa are suppose to make a reservation form that will be linked into a certain e-mail address.. wa are advised to use PHP scrip. what are the codes that i have to include into my form to send the data inputted by the customers.

How do I send data from a form in a website to a certain email add using PHP script?
Heres a sample email script for you to play with.


Place this on the form submission page %26amp; edit to your needs:








$emailfromaddr = "name@outgoing_server.com";


$emailfromname = "Your Name";





$emailheaders = "From: $emailfromname %26lt;$emailfromaddr%26gt;\n";


$emailheaders .= "Reply-To: $emailfromaddr\n";


$emailheaders .= "X-Mailer: PHP/" . phpversion() . "\n";


$emailheaders .= "X-Sender-IP: $REMOTE_ADDR\n";





$emailtoaddr = "name@incoming_server.com";





$msg = "First line of your email body\n";


$msg .= "Second line of your email body\n";


$emailsubject = "Subject of this email";





mail($emailtoaddr, $emailsubject, $msg, $emailheaders);








Also, check out the manual for more info on email headers if needed:


http://www.php.net/mail
Reply:check here for your answer


http://php.resourceindex.com/Complete_Sc...





http://www.sitescripts.com/PHP/
Reply:first off, I hope your school has a server where it has sending email through websites enabled. You can find fast email scripts on through google/yahoo search.





You have to take the input values, post back to the same page or another page, capture the values and then place them in a mail function. The mail function has a send property that will send off the email. This is true in all web programming languages.


No comments:

Post a Comment