Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. <?php
  2.  
  3. if (isset($_POST['myname'])) { $myname = $_POST['myname']; }
  4. if (isset($_POST['mypassword'])) { $mypassword = $_POST['mypassword']; }
  5. if (isset($_POST['mypasswordconf'])) { $mypasswordconf = $_POST['mypasswordconf']; }
  6. if (isset($_POST['mycomments'])) {
  7. $mycomments = filter_var($_POST['mycomments'], FILTER_SANITIZE_STRING );
  8. }
  9. if (isset($_POST['reference'])) { $reference = $_POST['reference']; }
  10. if (isset($_POST['favoritemusic'])) { $favoritemusic = $_POST['favoritemusic']; }
  11. if (isset($_POST['requesttype'])) { $requesttype = $_POST['requesttype']; }
  12.  
  13. $formerrors = false;
  14.  
  15. if ($myname === '') :
  16. $err_myname = '<div class="error">Sorry, your name is a required field</div>';
  17. $formerrors = true;
  18. endif; // input field empty
  19.  
  20. if (strlen($mypassword) <= 6):
  21. $err_passlength = '<div class="error">Sorry, the password must be at least six characters</div>';
  22. $formerrors = true;
  23. endif; //password not long enough
  24.  
  25.  
  26. if ($mypassword !== $mypasswordconf) :
  27. $err_mypassconf = '<div class="error">Sorry, passwords must match</div>';
  28. $formerrors = true;
  29. endif; //passwords don't match
  30.  
  31.  
  32. if ( !(preg_match('/[A-Za-z]+, [A-Za-z]+/', $myname)) ) :
  33. $err_patternmatch = '<div class="error">Sorry, the name must be in the format: Last, First</div>';
  34. $formerrors = true;
  35. endif; // pattern doesn't match
  36.  
  37.  
  38. if (!($formerrors)) :
  39. $to = "patrickjmcd121@gmail.com";
  40. $subject = "From $myname -- Contact/Booking Page";
  41. $message = "$myname filled out the form";
  42. $headers = 'MIME-Version: 1.0' . "rn";
  43. $headers .= 'From: Patrick <patrickjmcd121@gmail.com>' . "rn";
  44. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
  45.  
  46. $replyto = "From: $email rn".
  47. "Reply-To: mshaun.mcdermott@ntlworld.com" . "rn";
  48.  
  49. if (mail($to, $subject, $message, $headers)):
  50. $msg = "Thanks for filling out our form";
  51. else:
  52. $msg = "Problem sending the message";
  53. endif; // mail form data
  54.  
  55. endif; // check for form errors
  56.  
  57. endif; //form submitted
  58. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement