Advertisement
Guest User

php problem

a guest
Oct 5th, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 13.04 KB | None | 0 0
  1. <?php
  2.  
  3. // Replace this with your own email address
  4. $siteOwnersEmail = 'thegamezbus@gmail.com';
  5.  
  6.  
  7. if($_POST) {
  8.  
  9.   $fullname = trim(stripslashes($_POST['contactfullname']));
  10.   $childname = trim(stripslashes($_POST['contactchildname']));
  11.   $groupage = trim(stripslashes($_POST['contactgroupage']));
  12.   $numberchildren = trim(stripslashes($_POST['contactnumberchildren']));
  13.   $partydate = trim(stripslashes($_POST['contactpartydate']));
  14.   $partyhour = trim(stripslashes($_POST['contactpartyhour']));
  15.   $email = trim(stripslashes($_POST['contactemail']));
  16.   $phonenumber = trim(stripslashes($_POST['contactphonenumber']));
  17.   $fulladdress = trim(stripslashes($_POST['contactfulladdress']));
  18.   $package = trim(stripslashes($_POST['contactpackage']));
  19.   $extras = trim(stripslashes($_POST['contactextras']));
  20.  
  21.   // Check Full Name
  22.     if (strlen($fullname) < 2) {
  23.         $error['fullname'] = "Please enter your full name.";
  24.     }
  25.     // Check Child Name
  26.     if (strlen($childname) < 2) {
  27.         $error['childname'] = "Please enter your child's name'.";
  28.     }
  29.     // Check Group Age
  30.     if (strlen($groupage) < 2) {
  31.         $error['groupage'] = "Please enter the age of the child.";
  32.     }
  33.     // Check Number Of Children
  34.     if (strlen($numberchildren) < 1) {
  35.         $error['numberchildren'] = "Please enter the number of expected children.";
  36.     }
  37.     // Check Date of Party
  38.     if (strlen($partydate) < 1) {
  39.         $error['partydate'] = "Please enter the date of the party.";
  40.     }
  41.     // Check Time of party
  42.     if (strlen($partyhour) < 1) {
  43.         $error['partyhour'] = "Please enter the time of the party.";
  44.     }
  45.     // Check Email
  46.     if (!preg_match('/^[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*+[a-z]{2}/is', $email)) {
  47.         $error['email'] = "Please enter a valid email address.";
  48.     }
  49.     // Check Full Address
  50.     if (strlen($fulladdress) < 1) {
  51.         $error['fulladdress'] = "Please enter your full address.";
  52.     }
  53.     // Check Phone Number
  54.     if (strlen($phonenumber) < 1) {
  55.         $error['phonenumber'] = "Please enter your phone number."
  56.     }
  57.     // Check Package Required
  58.     if (strlen($package) < 1) {
  59.         $error['package'] = "Please enter the package required.";
  60.     }
  61.    
  62.    
  63.   // Subject
  64.     if ($subject == '') { $subject = "Contact Form Submission"; }
  65.     // Set Name
  66.     $name = $fullname;
  67.   // Set Message
  68.   $message .= "Email from: " . $name . "<br />";
  69.    $message .= "Child Name: " . $childname . "<br />";
  70.    $message .= "Group Age: " . $groupage . "<br />";
  71.    $message .= "Number Of Children: " . $numberchildren . "<br />";
  72.    $message .= "Date Of Party: " . $partydate . "<br />";
  73.    $message .= "Time Of Party: " . $partyhour . "<br />";
  74.    $message .= "Email Address: " . $email . "<br />";
  75.    $message .= "Phone Number: " . $phonenumber . "<br />";
  76.    $message .= "Full Address: " . $fulladdress . "<br />";
  77.    $message .= "Package Requirements: " . $package . "<br />";
  78.    $message .= "Aditional Services: " . $extras . "<br />";
  79.    $message .= "Message: <br />";
  80.    $message .= "<br /> ----- <br /> This email was sent from the GamezBus site's contact form. <br />";
  81.  
  82.    // Set From: header
  83.    $from =  $name . " <" . $email . ">";
  84.  
  85.    // Email Headers
  86.     $headers = "From: " . $from . "\r\n";
  87.     $headers .= "Reply-To: ". $email . "\r\n";
  88.     $headers .= "MIME-Version: 1.0\r\n";
  89.     $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
  90.  
  91.  
  92.    if (!$error) {
  93.  
  94.       ini_set("sendmail_from", $siteOwnersEmail); // for windows server
  95.       $mail = mail($siteOwnersEmail, $fullname, $email, $phonenumber, $fulladdress, $headers);
  96.  
  97.         if ($mail) { echo "OK"; }
  98.       else { echo "Something went wrong. Please try again."; }
  99.        
  100.     } # end if - no validation error
  101.  
  102.     else {
  103.  
  104.         $response .= (isset($error['fullname'])) ? $error['fullname'] . "<br /> \n" : null;
  105.         $response .= (isset($error['childname'])) ? $error['childname'] . "<br /> \n" : null;
  106.         $response .= (isset($error['groupage'])) ? $error['groupage'] . "<br /> \n" : null;
  107.         $response .= (isset($error['numberchildren'])) ? $error['numberchildren'] . "<br />" : null;
  108.         $response .= (isset($error['partydate'])) ? $error['partydate'] . "<br /> \n" : null;
  109.         $response .= (isset($error['partyhour'])) ? $error['partyhour'] . "<br /> \n" : null;
  110.         $response .= (isset($error['email'])) ? $error['email'] . "<br /> \n" : null;
  111.         $response .= (isset($error['phonenumber'])) ? $error['phonenumber'] . "<br />" : null;
  112.         $response .= (isset($error['fulladdress'])) ? $error['fulladdress'] . "<br /> \n" : null;
  113.         $response .= (isset($error['package'])) ? $error['package'] . "<br /> \n" : null;
  114.         $response .= (isset($error['othercomments'])) ? $error['othercomments'] . "<br /> \n" : null;
  115.        
  116.        
  117.         echo $response;
  118.  
  119.     } # end if - there was a validation error
  120.  
  121. }
  122.  
  123. ?><!DOCTYPE html>
  124. <!--[if lt IE 8 ]><html class="no-js ie ie7" lang="en"> <![endif]-->
  125. <!--[if IE 8 ]><html class="no-js ie ie8" lang="en"> <![endif]-->
  126. <!--[if IE 9 ]><html class="no-js ie ie9" lang="en"> <![endif]-->
  127. <!--[if (gte IE 9)|!(IE)]><!-->
  128.  
  129. <html class="no-js" lang="en">
  130.     <!--<![endif]-->
  131.  
  132.     <head>
  133.  
  134.         <!--- Basic Page Needs ================================================== -->
  135.         <meta charset="utf-8">
  136.  
  137.         <title>GamezBus Booking Form</title>
  138.  
  139.         <meta name="description" content="games, bus, gamesbus, games bus, busgames, bus games, cre8, duncan, gamezbus">
  140.  
  141.         <meta name="author" content="Bulciu Vasile Andrei">
  142.  
  143.         <!-- Mobile Specific Metas ================================================== -->
  144.         <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  145.  
  146.         <!-- CSS ================================================== -->
  147.         <link rel="stylesheet" href="css/base.css">
  148.  
  149.         <link rel="stylesheet" href="css/main.css">
  150.  
  151.         <link rel="stylesheet" href="css/media-queries.css">
  152.  
  153.         <!-- Script =================================================== -->
  154.         <script src="js/modernizr.js"></script>
  155.  
  156.         <!-- Favicons =================================================== -->
  157.         <link rel="shortcut icon" href="favicon.png" >
  158.  
  159.     </head>
  160.  
  161.     <body class="homepage">
  162.  
  163.         <div id="preloader">
  164.  
  165.             <div id="status">
  166.  
  167.                 <img src="images/loader.gif" height="60" width="60" alt="">
  168.  
  169.                 <div class="loader">
  170.                     Loading...
  171.                 </div>
  172.  
  173.             </div>
  174.  
  175.         </div>
  176.  
  177.         <!-- About Section ================================================== -->
  178.         <section id="about">
  179.  
  180.             <div class="row section-head">
  181.  
  182.                 <div class="twelve columns">
  183.  
  184.                     <h1>Booking Form<span>.</span></h1>
  185.  
  186.                     <hr />
  187.  
  188.                     <h2><b>The Gamez Bus</b></h2>
  189.                     <h3><b>Cre8 Solutions Ltd, 181 Forest Road, Fairlop, Essex, IG6 3HZ</b></h3>
  190.                     <hr />
  191.                     <br />
  192.                     <p>
  193.                         Please also note that apart from the GamezBus, we offer the following aditional services:
  194.                     </p>
  195.  
  196.                     <p>
  197.                         Mega gaming Party bags - £10 per child
  198.                     </p>
  199.                     <p>
  200.                         Cold drinks package £2 per child
  201.                     </p>
  202.                     <p>
  203.                         Sweets, crisps and drinks package £10 per child
  204.                     </p>
  205.                     <p>
  206.                         Fruit and healthy snack packs £10 per child
  207.                     </p>
  208.                     <p>
  209.                         Adult refreshments including coffee, tea etc. served on day at additional cost
  210.                     </p>
  211.                     <p>
  212.                         If any aditional services are required, please mention them in the "Other extras" box on the order form
  213.                     </p>
  214.                     <br />
  215.                     <p>
  216.                         Games Required: Please specify any games required by children, We carry a full range of the latest games on-board however, we prefer to be told of any must have titles.
  217.                     </p>
  218.                     <br />
  219.  
  220.                     <h1>Complete the form below and we will get back to you as soon as possible. Thank you</h1>
  221.                 </div>
  222.  
  223.             </div>
  224.  
  225.             <!-- About Section ================================================== -->
  226.  
  227.             <!-- Form Section ================================================== -->
  228.  
  229.             <div class="row form-section">
  230.  
  231.                 <div id="order-form" class="twelve columns">
  232.  
  233.                     <form name="orderForm" id="orderForm" method="post" action="">
  234.  
  235.                         <fieldset>
  236.  
  237.                             <div class="row">
  238.  
  239.                                 <div class="six columns mob-whole">
  240.  
  241.                                     <label for="contactfullname">Full Name<span class="required">*</span></label>
  242.  
  243.                                     <input name="contactfullname" type="text" id="contactfullname" placeholder="Full Name" value="" />
  244.  
  245.                                 </div>
  246.  
  247.                                 <div class="six columns mob-whole">
  248.  
  249.                                     <label for="contactchilname">Child Name<span class="required">*</span></label>
  250.  
  251.                                     <input name="contactchilname" type="text" id="contactchilname" placeholder="Child Name" value="" />
  252.  
  253.                                 </div>
  254.  
  255.                             </div>
  256.  
  257.                             <div class="row">
  258.  
  259.                                 <div class="six columns mob-whole">
  260.  
  261.                                     <label for="contactgroupage">Group Age<span class="required">*</span></label>
  262.  
  263.                                     <input name="contactgroupage" type="text" id="contactgroupage" placeholder="Group Age" value="" />
  264.  
  265.                                 </div>
  266.  
  267.                                 <div class="six columns mob-whole">
  268.  
  269.                                     <label for="contactnumberchildren">Number Of Children<span class="required">*</span></label>
  270.  
  271.                                     <input name="contactnumberchildren" type="text" id="contactnumberchildren" placeholder="Number of children" value="" />
  272.  
  273.                                 </div>
  274.  
  275.                             </div>
  276.  
  277.                             <div class="row">
  278.  
  279.                                 <div class="six columns mob-whole">
  280.  
  281.                                     <label for="contactpartydate">Date of Party<span class="required">*</span></label>
  282.  
  283.                                     <input name="contactpartydate" type="text" id="contactpartydate" placeholder="Date of party" value="" />
  284.  
  285.                                 </div>
  286.  
  287.                                 <div class="six columns mob-whole">
  288.  
  289.                                     <label for="contactpartyhour">Time of party<span class="required">*</span></label>
  290.  
  291.                                     <input name="contactpartyhour" type="text" id="contactpartyhour" placeholder="Time of Party"  value="" />
  292.  
  293.                                 </div>
  294.  
  295.                             </div>
  296.  
  297.                             <div class="row">
  298.  
  299.                                 <div class="six columns mob-whole">
  300.  
  301.                                     <label for="contactemail">Email Address<span class="required">*</span></label>
  302.  
  303.                                     <input name="contactemail" type="text" id="contactemail" placeholder="Email" value="" />
  304.  
  305.                                 </div>
  306.  
  307.                                 <div class="six columns mob-whole">
  308.  
  309.                                     <label for="contactphonenumber">Phone Number<span class="required">*</span></label>
  310.  
  311.                                     <input name="contactphonenumber" type="text" id="contactphonenumber" placeholder="Number" value="" />
  312.  
  313.                                 </div>
  314.  
  315.                             </div>
  316.  
  317.                             <div class="row">
  318.  
  319.                                 <div class="six columns mob-whole">
  320.  
  321.                                     <label for="contactfulladdress">Full Address<span class="required">*</span></label>
  322.                                     <textarea name="contactfulladdress"  id="contactfulladdress" placeholder="Full Address" rows="1" cols="50" ></textarea>
  323.                                      
  324.  
  325.  
  326.                                 </div>
  327.  
  328.                             </div>
  329.  
  330.                             <div class="row">
  331.  
  332.                                 <div class="six columns mob-whole">
  333.  
  334.                                     <label for="contactpackage">Package Required<span class="required">*</span></label>
  335.                                     <textarea name="contactpackage"  id="contactpackage" placeholder="Briefly explain what your booking would contain." rows="10" cols="50" ></textarea>
  336.                                      
  337.  
  338.  
  339.                                 </div>
  340.  
  341.                                 <div class="six columns mob-whole">
  342.  
  343.                                     <label for="contactextras">Other Extras</label>
  344.                                     <textarea name="contactextras"  id="contactextras" placeholder="Please feel free to add any optional extras here." rows="10" cols="50" ></textarea>
  345.                                      
  346.  
  347.  
  348.                                 </div>
  349.  
  350.                             </div>
  351.  
  352.                             <hr />
  353.  
  354.                             <div>
  355.                                 <button class="submit full-width">
  356.                                     Send Message
  357.                                 </button>
  358.  
  359.                                 <div id="image-loader">
  360.                                     <img src="images/loader.gif" alt="" />
  361.  
  362.                                 </div>
  363.  
  364.                             </div>
  365.  
  366.                         </fieldset>
  367.  
  368.                     </form>
  369.                     <!-- /orderForm -->
  370.  
  371.                     <!-- message box -->
  372.                     <div id="message-warning">
  373.  
  374.                     </div>
  375.  
  376.                     <div id="message-success">
  377.  
  378.                         <i class="fa fa-check"></i>Your message was sent, thank you!
  379.                         <br />
  380.  
  381.                     </div>
  382.  
  383.                 </div>
  384.                 <!-- /order-form -->
  385.  
  386.             </div>
  387.             <!-- /form-section -->
  388.  
  389.             <!-- /Form Section ================================================== -->
  390.  
  391.             <!-- Footer ================================================== -->
  392.             <footer>
  393.  
  394.                 <div class="row">
  395.  
  396.                     <div class="six columns tab-whole right-cols">
  397.  
  398.                         <p class="homepage">
  399.                             <a href="index.html">Back To The Homepage</a>
  400.                         </p>
  401.  
  402.                     </div>
  403.                     <!-- /row -->
  404.  
  405.                     <div class="row">
  406.  
  407.                         <div class="six columns tab-whole right-cols">
  408.  
  409.                             <p class="copyright">
  410.                                 &copy; Copyright 2015 <a href="http://www.facebook.com/gamezbus">Gamezbus</a>. Design by <a href="http://www.facebook.com/andreipath">Bulciu Vasile Andrei.</a>
  411.                             </p>
  412.  
  413.                         </div>
  414.                         <!-- /row -->
  415.  
  416.             </footer>
  417.             <!-- /footer -->
  418.  
  419.             <!-- Java Script ================================================== -->
  420.             <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  421.  
  422.             <script>
  423.                 window.jQuery || document.write('<script src="js/jquery-1.10.2.min.js"><\/script>')
  424.  
  425.             </script>
  426.  
  427.             <script type="text/javascript" src="js/jquery-migrate-1.2.1.min.js"></script>
  428.  
  429.             <script src="js/jquery.flexslider.js"></script>
  430.  
  431.             <script src="js/jquery.fittext.js"></script>
  432.  
  433.             <script src="js/backstretch.js"></script>
  434.  
  435.             <script src="js/waypoints.js"></script>
  436.  
  437.             <script src="js/main.js"></script>
  438.  
  439.     </body>
  440.  
  441. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement