Search the Community
Showing results for tags 'order form'.
-
Hello everyone. I am writing this order/feedback form using a php script. Every time i hit submit, the html page (that has the form inside) just reloads and does not perform the script could anyone give me some pointers in my code the form/php? I have made sure they are linked verbatim I am a nube so please forgive my inexperience Here is the form in the html , down below it is the corresponding php code for the form <form action="send_mail.php" method="post"> <table align="left"> <tr> <td> <input type="checkbox" name="food1" value="" /> 1 Fudge Brownie</td> <td><input style="color:#000000" type="number" name="onefudgebrownie" /> </td> </tr> <tr> <td> <input type="checkbox" name="food2" value="" /> 4 Italian Biscotti </td> <td><input style="color:#000000" type="number" name="fouritalianbiscotti" /> </td> </tr> <tr> <td> <input type="checkbox" name="food3" value="" /> 4 Soft & Chewy Chocolate Chip Cookies</td> <td><input style="color:#000000" type="number" name="foursoftchewychocolatechipcookies" /> </td> </tr> <tr> <td> <input type="checkbox" name="food4" value="" /> 4 Cape Cod Cranberry Oatmeal Cookies</td> <td><input style="color:#000000" type="number" name="fourcapecodcranberryoatmealcookies" /> </td> </tr> <tr> <td> <input type="checkbox" name="food5" value="" /> 1 Loaf of Artisan French Bread. </td> <td><input style="color:#000000" type="number" name="oneloafofartisanfrenchbread" /> </td> </tr> <tr> <td> <input type="checkbox" name="food6" value="" /> 6 Kaiser Deli Rolls </td> <td><input style="color:#000000" type="number" name="sixkaiserdelirolls" /> </td> </tr> <tr> <td> <input type="checkbox" name="food7" value="" /> 6 Soft Hamburger Rolls</td> <td><input style="color:#000000" type="number" name="sixsofthamburgerrolls"/> </td> </tr> <tr> <td> <input type="checkbox" name="food8" value=""/> 6 5 sub rolls</td> <td><input style="color:#000000" type="number" name="sixfiveinchsubrolls"/> </td> </tr> <tr> <td> <input type="checkbox" name="food9" value="" /> 12 2" slider rolls</td> <td><input style="color:#000000" type="number" name="twelvetwoinchsliderrolls"/> </td> </tr> <tr> <td> <input type="checkbox" name="food10" value="" /> 4 Snickerdoodle Cookies</td> <td><input style="color:#000000" type="number" name="foursnkickerdoodlecookies"/> </td> </tr> <tr> <td> <input type="checkbox" name="food11" value="" /> 1 Colossal Cinnamon Sticky Bun</td> <td><input style="color:#000000" type="number" name="onecolossalcinnamonstickybun"/> </td> </tr> <tr> <td> <input type="checkbox" name="food12" value="" /> 1 Delicious Whoopie Pie</td> <td><input style="color:#000000" type="number" name="onedeliciouswhoopiepie"/> </td> </tr> <tr> <td> <input type="checkbox" name="food13" value="" /> 4 island coconut macaroons</td> <td><input style="color:#000000" type="number" name="fourislandcoconutmacaroons"/> </td> </tr> <tr> <td>Comments/Special Requests:</td> <td> <textarea rows="10" cols="50" name="comments" style="color:#000000" ></textarea> </td> </tr> </table> <br></br> <!--Shipping info/Personal Info Table --> <h3 align="left"> Shipping Information </h3> <table align="left"> <tr> <td>Last Name:</td> <td> <input style="color:#000000" type="text" name="shippinglastname" value="" maxlength="15" /> </td> <td>First Name:</td> <td> <input style="color:#000000" type="text" name="shippingfirstname" value="" maxlength="10" /> </td> </tr> <td>Telephone/Cell.:</td> <td> <input style="color:#000000" type="text" name="telephonecell" value="" maxlength="100" /> </td> <td>Email Address:</td> <td> <input style="color:#000000" type="text" name="emailaddress" value="" maxlength="100" /> </td> </tr> <tr> <td>Brief description of location on the lake:</td> <td> <textarea rows="10" cols="50" name="breifdescript" style="color:#000000"> </textarea> </td> </tr> <!--SUBMIT BUTTON --> <tr> <td> </td> <td> <input type="submit" value="Submit" style= " background-color:#87D163; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius:6px; color: #fff; font-family: 'Oswald'; font-size: 20px; text-decoration: none; cursor: pointer; border:none; submit:hover { border: none; background:#000000; box-shadow: 0px 0px 1px #777; }" /> </td> </tr> <!--SUBMIT BUTTON end --> </table> </form> PHP code below; <?php /*SET THIS RIGHT BELOW AS THE FORM RECIEVING EMAIL*/ $webmaster_email = "__________@gmail.com"; /* This bit sets the URLs of the supporting pages. If you change the names of any of the pages, you will need to change the values here. */ $feedback_page = "feedback_form.html"; $error_page = "error_message.html"; $thankyou_page = "thank_you.html"; /* This next bit loads the form field data into variables. If you add a form field, you will need to add it here. */ /* First section of variables are for the Items/Food */ $food1 = $_REQUEST['food1'] ; $onefudgebrownie = $_REQUEST['onefudgebrownie'] ; $food2 = $_REQUEST['food2'] ; $fouritalianbiscotti = $_REQUEST['fouritalianbiscotti'] ; $food3 = $_REQUEST['food3'] ; $foursoftchewychocolatechipcookies = $_REQUEST['foursoftchewychocolatechipcookies'] ; $food4 = $_REQUEST['food4'] ; $fourcapecodcranberryoatmealcookies = $_REQUEST['fourcapecodcranberryoatmealcookies'] ; $food5 = $_REQUEST['food5'] ; $oneloafofartisanfrenchbread = $_REQUEST['oneloafofartisanfrenchbread'] ; $food6 = $_REQUEST['food6'] ; $sixkaiserdelirolls = $_REQUEST['sixkaiserdelirolls'] ; $food7 = $_REQUEST['food7'] ; $sixsofthamburgerrolls = $_REQUEST['sixsofthamburgerrolls'] ; $food8 = $_REQUEST['food8'] ; $sixfiveinchsubrolls = $_REQUEST['sixfiveinchsubrolls'] ; $food9 = $_REQUEST['food9'] ; $twelvetwoinchsliderrolls = $_REQUEST['twelvetwoinchsliderrolls'] ; $food10 = $_REQUEST['food10'] ; $foursnkickerdoodlecookies = $_REQUEST['foursnkickerdoodlecookies'] ; $food11 = $_REQUEST['food11'] ; $onecolossalcinnamonstickybun = $_REQUEST['onecolossalcinnamonstickybun'] ; $food12 = $_REQUEST['food12'] ; $onedeliciouswhoopiepie = $_REQUEST['onedeliciouswhoopiepie'] ; $food13 = $_REQUEST['food13'] ; $fourislandcoconutmacaroons = $_REQUEST['fourislandcoconutmacaroons'] ; /* This second section of variables are for the Shipping/Customer Info*/ $shippinglastname = $_REQUEST['shippinglastname'] ; $shippingfirstname = $_REQUEST['shippingfirstname'] ; $telephonecell = $_REQUEST['telephonecell'] ; $emailaddress = $_REQUEST['emailaddress'] ; $breifdescript = $_REQUEST['breifdescript'] ; /* The following function checks for email injection. Specifically, it checks for carriage returns - typically used by spammers to inject a CC list. */ function isInjected($str) { $injections = array('(\n+)', '(\r+)', '(\t+)', '(%0A+)', '(%0D+)', '(%08+)', '(%09+)' ); $inject = join('|', $injections); $inject = "/$inject/i"; if(preg_match($inject,$str)) { return true; } else { return false; } } // If the user tries to access this script directly, redirect them to the feedback form, if (!isset($_REQUEST['email_address'])) { header( "Location: $feedback_page" ); } // If the form fields are empty, redirect to the error page. elseif (empty($email_address) || empty($comments)) { header( "Location: $error_page" ); } // If email injection is detected, redirect to the error page. elseif ( isInjected($email_address) ) { header( "Location: $error_page" ); } // If we passed all previous tests, send the email then redirect to the thank you page. else { mail( "$webmaster_email", "Feedback Form Results", $comments, "From: $email_address" ); header( "Location: $thankyou_page" ); } ?> dessertsondemandorderform.html