Advertisement
iconfixit

contact.php

Jun 8th, 2011
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.29 KB | None | 0 0
  1.  <?php
  2.  
  3. $from = $_REQUEST['Email'];
  4. $name = $_REQUEST['Name'];
  5. $headers = "From: $from";
  6. $subject = "YPW Contact Form";
  7. $fields = array();
  8. $fields{"Name"} = "Name";
  9. $fields{"Company"} = "Company";
  10. $fields{"Email"} = "Email";
  11. $fields{"Phone"} = "Phone";
  12. $fields{"Message"} = "Message";
  13.  
  14. $body = "We have received the following information:\n\n";
  15. foreach ($fields as $a => $b)
  16. {
  17.     $body .= sprintf("%20s: %s\n", $b, $_REQUEST[$a]);
  18. }
  19.  
  20. $headers2 = "From: [email protected]";
  21. $subject2 = "Thank you for contacting us";
  22. $autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible. If you have any more questions, please consult our website at www.yardleypressurewash.com";
  23.  
  24. if ($from == '')
  25. {
  26.     print "You have not entered an email, please go back and try again";
  27. }
  28. else
  29. {
  30.     if ($name == '')
  31.     {
  32.         print "You have not entered a name, please go back and try again";
  33.     }
  34.     else
  35.     {
  36.         $send = mail($to, $subject, $body, $headers);
  37.         $send2 = mail($from, $subject2, $autoreply, $headers2);
  38.         if ($send)
  39.         {
  40.             header("Location: http://www.yardleypressurewash.com/thankyou.html");
  41.         }
  42.         else
  43.         {
  44.             print "We encountered an error sending your mail, please notify [email protected]";
  45.         }
  46.     }
  47. }
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement