mroberts46 Posted July 2, 2013 Share Posted July 2, 2013 This has been bugging me for over a week now. I am admittedly a newbie with php but I think this shouldn't be that hard. Below is the code from my page. I need it to redirect to another page called thankyou.htm where the user will get a Thank You message and a PayPal button to pay for the services they have selected. I can't get this code to do the redirect and I've tried it several different ways. Can somebody please help me solve this issue quickly? The Code: <?php $fName = $_POST['fName']; $lName = $_POST['lName']; $email = $_POST['email']; $cEmail = $_POST['cEmail']; $phone = $_POST['tele']; $pickUp = $_POST['pickUp']; $dropOff = $_POST['dropOff']; $date = $_POST['date']; $service = $_POST['service']; $instruct = $_POST['instruct']; $human = $_POST['human']; $thankyou = 'thankyou.htm'; $from = 'From: Joyful Xpressions'; $to = 'example@sample.com'; $subject = 'Service Request'; $body = "From: $fName $lName\n E-Mail: $email\n Phone: $phone\n \n Pick Up Location: $pickUp\n Drop Off Location: $dropOff\n Pick Up Date: $date\n \n Service Requested: $service\n \n Special Instructions: $instruct"; ?> <!doctype html> <html class="no-js"> <!-- InstanceBegin template="/Templates/main.dwt" codeOutsideHTMLIsLocked="false" --> <head> <meta name="description" content="We do the washing and folding while you focus on the busy activities in everyday life."> <meta name="keywords" content="Joyful,Xpressions,washing,folding,laundry,Dallas,pick up"> <meta name="author" content="Harried Enterprises"> <meta charset="utf-8"> <!-- InstanceBeginEditable name="doctitle" --> <title>Joyful Xpressions CRegister</title> <!-- InstanceEndEditable --> <link href="Resources/Styles/layout.css" media="screen" rel="stylesheet" type="text/css" /> <script type="text/javascript"> $(function() { if ($.browser.msie && $.browser.version.substr(0,1)<7) { $('li').has('ul').mouseover(function(){ $(this).children('ul').css('visibility','visible'); }).mouseout(function(){ $(this).children('ul').css('visibility','hidden'); }) } }); </script> <script src="//use.edgefonts.net/nosifer:n4:all;muli:n3,i3,n4,i4:all.js"></script> <!--[if lt IE 9]> <script src="dist/html5shiv.js"></script> <![endif]--> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> </head> <body> <div id="wrapper"> <header> <img src="Resources/Images/header.png" alt="Joyful Xpressions Logo" width="960" height="150" /> <ul id="menu"> <li><a href="index.htm">Home</a></li> <li> <a href="#">About Us</a> <ul> <li><a href="company.htm">Our Company</a></li> <li><a href="services.htm">Our Services</a></li> <li><a href="questions.htm">FAQ</a></li> </ul> </li> <li><a href="contact.htm">Contact</a></li> </ul> <div class="clear"> </div> </header> <div class="clear"> </div> <section id="content"> <!-- InstanceBeginEditable name="mainContent" --> <form action="service.php" method="post" name="register" onSubmit="document.location='thankyou.htm';"> <h2>Register</h2> <p>Give us a try! Use this form to sign up for your first FREE pick up. Enter your information below and submit. You will get a Paypal button which allows you to select the service you want and proceed to Paypal's secure payment page to process your payment. You may be asked to enter some information again.</p> <hr/> <fieldset> <legend>Personal Information</legend> <label for="fName">First Name: </label> <input autocomplete="on" autofocus name="fName" placeholder="First Name" required type="text" /> <br/> <label for="lName">Last Name: </label> <input autocomplete="on" name="lName" placeholder="Last Name" required type="text" /> <br/> <label for="email">Email: </label> <input autocomplete="on" name="email" placeholder="john.doe@example.com" required type="email" /> <br/> <label for="cEmail">Confirm Email: </label> <input autocomplete="off" name="cEmail" placeholder="john.doe@example.com" required type="email" /> <br/> <label for="tele">Phone: </label> <input autocomplete="on" name="tele" placeholder="555-555-5555" required type="tel" /> </fieldset> <br/> <br/> <fieldset> <legend>Service Request</legend> <label for="pickUp">Complete Address for Pickup: </label> <textarea cols="20" name="pickUp" placeholder="Please enter your desired pickup location." required rows="3"></textarea> <br/> <label for="dropOff">Complete Address for Delivery: </label> <textarea cols="20" name="dropOff" placeholder="Please enter your desired drop off location." required rows="3"></textarea> <br/> <label for="date">Pickup Date: </label> <input autocomplete="off" min="2013-01-01" name="date" required type="date" /> <br/> <label for="service">Chore: </label> <select name="service"> <option value="1 Bag">1 Bag $35.00 USD</option> <option value="2 Bags">2 Bags $65.00 USD</option> <option value="Express Service">Express Service $15.00 USD</option> <option value="King Comforter">King Comforter $20.00 USD</option> <option value="Queen Comforter">Queen Comforter $15.00 USD</option> </select> <br/> </fieldset> <br/> <br/> <fieldset> <legend>Special Intructions</legend> <textarea cols="70" name="instruct" placeholder="Please enter any special instructions you may have regarding your service request here." rows="10"></textarea> <br/> </fieldset> <br/> <br/> <fieldset> <label>*What is 2+2? (Anti-spam)</label> <input name="human" placeholder="Type Here"> <br/> <br/> <input id="submit" name="submit" type="submit" value="Submit Information"> </fieldset> <br/> <? if ($_POST['submit'] && $human == '4') { if (mail ($to, $subject, $body, $from)) { header ("Location: http://www.expressyourchores.com/thankyou.htm"); echo '<p>Your message has been sent!</p>'; } else { echo '<p>Something went wrong, go back and try again!</p>'; } } else if ($_POST['submit'] && $human != '4') { echo '<p>You answered the anti-spam question incorrectly!</p>'; } ?> </form> PLEASE HELP!!! Quote Link to comment https://forums.phpfreaks.com/topic/279808-php-email-form-redirect/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.