Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jun 28th, 2012  |  syntax: PHP  |  size: 3.52 KB  |  views: 28  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /* Functions used */
  3. function check_input($data, $problem='')
  4. {
  5. $data = trim($data);
  6. $data = stripslashes($data);
  7. $data = htmlspecialchars($data);
  8. if ($problem && strlen($data) == 0)
  9. {
  10.     show_error($problem);
  11. }
  12. return $data;
  13. }
  14. function show_error($myError)
  15. {
  16. ?>
  17. <b>We apologize for the inconvenience, an error occurred.</b><br />
  18. <?php echo $myError; ?>
  19. <?php
  20. exit();
  21. }
  22. /* Set e-mail recipient */
  23. $myemail  = "example@gmail.com";
  24.  
  25. /* Check all form inputs using check_input function */
  26. $names = check_input($_POST['names'], "Please return to our Application Form and enter your and your future spouse's names.");
  27. $weddingtype = check_input($_POST['weddingtype'], "Please return to our Application Form and fill in what kind of wedding you will be having.");
  28. $religioussect = check_input($_POST['religioussect'], "Please return to our Application Form and tell us about your religion and wedding traditions.");
  29. $dateone = check_input($_POST['dateone'], "Please return to our Application Form and give us the date for at least one event.");
  30. $eventone = check_input($_POST['eventone'], "Please return to our Application Form and list at least one event.");
  31. $locationone = check_input($_POST['locationone'], "Please return to our Application Form and give us the location for at least one event.");
  32. $durationone = check_input($_POST['durationone'], "Please return to our Application Form and give us the duration of at least one event.");
  33. $typeone = check_input($_POST['typeone'], "Please return to our Application Form and tell us whether you would like video, photo or both for at least one event.");
  34. $datetwo = $_POST['datetwo'];
  35. $eventtwo = $_POST['eventtwo'];
  36. $locationtwo = $_POST['locationtwo'];
  37. $durationtwo = $_POST['durationtwo'];
  38. $typetwo = $_POST['typetwo'];
  39. $datethree = $_POST['datethree'];
  40. $eventthree = $_POST['eventthree'];
  41. $locationthree = $_POST['locationthree'];
  42. $durationthree = $_POST['durationthree'];
  43. $typethree = $_POST['typethree'];
  44. $datefour = $_POST['datefour'];
  45. $eventfour = $_POST['eventfour'];
  46. $locationfour = $_POST['locationfour'];
  47. $durationfour = $_POST['durationfour'];
  48. $typefour = $_POST['typefour'];
  49. $guests1 = check_input($_POST['guests1'], "Please return to our Application Form and tell us how many guests will attend at least one event.");
  50. $guests2 = $_POST['guests2'];
  51. $guests3 = $_POST['guests3'];
  52. $guests4 = $_POST['guests4'];
  53. $concerns = $_POST['concerns'];
  54.  
  55.  
  56. if(!isset($_POST['submit'])){
  57.  
  58. $subject = "Quote Application";
  59.  
  60.  
  61. /*Message for the e-mail */
  62. $message = "Hello!
  63.  
  64. Another happy couple has filled out a Quote Application Form :D Hooray!
  65.  
  66. Their names are $names.
  67.  
  68. What sort of wedding are they having?
  69. '$weddingtype'.
  70.  
  71. What religious sect and wedding traditions are they following?
  72. '$religioussect'.
  73.  
  74. Now for their wedding events... Ooh boy!
  75.  
  76. 1.  $dateone    
  77. $eventone
  78. $durationone
  79. $typeone
  80. Estimated guests: $guests1
  81.  
  82. $locationone
  83.  
  84. 2.  $datetwo    
  85. $eventtwo
  86. $durationtwo
  87. $typetwo
  88. Estimated guests: $guests2
  89.  
  90. $locationtwo
  91.  
  92. 3.  $datethree  
  93. $eventthree
  94. $durationthree
  95. $typethree
  96. Estimated guests: $guests3
  97.  
  98. $locationthree
  99.  
  100. 4.  $datefour
  101. $eventfour
  102. $durationfour
  103. $typefour
  104. Estimated guests: $guests4
  105.  
  106. $locationfour
  107.  
  108.  
  109. Any concerns the couple have follow here:
  110. '$concerns'
  111.  
  112. You better be ready to get to work now!
  113. And also, have a really good day :)
  114. ";
  115.  
  116.  
  117. /* Send the message using mail() function */
  118. mail($myemail, $subject, $message);
  119.  
  120. /* Redirect visitor to the thank you page */
  121. header('Location: thanks.html');
  122. exit();
  123. }
  124. ?>
clone this paste RAW Paste Data