Monday 18 August 2014

How to send email a form data using php


Form is a electronic way where organization gathered data from user through website. A website owner usually take details of esquires to his website using login provide by the website developer.
But we are familiar with email because it’s an era  of android word and every one configure email with mobile so sending form data in email as well as database is a good idea.
PHP provide a easy way to achieve this just take a look on flowing code and please don’t say thanks to me.

                    $to =' rajkumar9795@gmail.com';
                  $subject = 'Enquiry Data';
                  $message = "<h2>Welcome This is Enquiry for Now</h2><hr>Name : $_POST[name]<br>Gender :  $_POST[gen]<br>Course : $_POST[course]<br> Email : $_POST[email]<br>Mobile : $_POST[phone]<br>Query : $_POST[query]";
                 
                  $headers = 'From: bcmt@basantgroupofinstitution.org' . "\r\n" .
                                  'Reply-To: basantcollege.mt@gmail.com' . "\r\n" .
                                  'X-Mailer: PHP/' . phpversion().
'MIME-Version: 1.0' . "\r\n".
'Content-type: text/html; charset=iso-8859-1' . "\r\n";
                 
                            mail($to, $subject, $message, $headers);                                                


No comments:

Post a Comment