Advertisement
Guest User

Untitled

a guest
Oct 1st, 2014
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <?php
  2. $errors = '';
  3. $myemail = 'matexoza@gmail.com';//<-----Put Your email address here.
  4. if(empty($_POST['name']) ||
  5. empty($_POST['email']) ||
  6. empty($_POST['phone']) ||
  7. empty($_POST['message']))
  8. {
  9. $errors .= "\n Error: all fields are required";
  10. }
  11.  
  12. $name = $_POST['name'];
  13. $email_address = $_POST['email'];
  14. $phone = $_POST['phone'];
  15. $message = $_POST['message'];
  16.  
  17. if (!preg_match(
  18. "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i",
  19. $email_address))
  20. {
  21. $errors .= "\n Error: Invalid email address";
  22. }
  23.  
  24. if( empty($errors))
  25. {
  26. $to = $myemail;
  27. $email_subject = "Contact form submission: $name";
  28. $email_body = "You have received a new message. ".
  29. " Here are the details:\n Name: $name \n Email: $email_address \n Phone: $phone \n Message \n $message";
  30.  
  31. $headers = "From: $myemail\n";
  32. $headers .= "Reply-To: $email_address";
  33.  
  34. mail($to,$email_subject,$email_body,$headers);
  35. //redirect to the 'thank you' page
  36. header('Location: contact-form-thank-you.html');
  37. }
  38. ?>
  39. <!doctype html>
  40.  
  41. <html lang="en">
  42. <head>
  43. <title>mattiesweb.com</title>
  44. <meta name="view" content="width=device-width, initial-scale=1.0">
  45. <link rel="stylesheet" href="css/bootstrap.min.css">
  46. <link rel="stylesheet" href="css/styles.css">
  47. <style type="text/css">body { background: ; }</style>
  48. </head>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement