July 16, 200818 yr Hi folks Please help! I am having form problems again. I am using a form validator for Dreamweaver by Hotdreamweaver. I am uplodaing the JScript folder to my server and he form seems to validate fine. However, after I have filled in the form I can't get it to send to my email address or redirect to a URL after the form has been submitted. I must be doing something simple wrong. Does anybody have any ideas please!? HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title></title> <script language='JavaScript' type='text/javascript' src='JScript/formValidator.js'></script> <script> function validate(formNode){ var formValidatorInstance = new FormValidator(formNode); formValidatorInstance.addRule('name','Please add your name.','required'); formValidatorInstance.addRule('email','A valid email address is required.','email'); formValidatorInstance.addRule('passenger','Input a valid number of passengers. (1-8)','rangevalues',Array(0,9)); formValidatorInstance.addRule('day','Pick up date (day) not complete.','required'); formValidatorInstance.addRule('month','Pick up date (month) not complete.','required'); formValidatorInstance.addRule('year','Pick up date (year) not complete.','required'); formValidatorInstance.addRule('hours','Pick up time (hour) not complete.','required'); formValidatorInstance.addRule('mins','Pick up time (minutes) not complete.','required'); formValidatorInstance.addRule('radio','AM/PM is required.','ischecked'); formValidatorInstance.addRule('radio','AM/PM is required.','ischecked'); formValidatorInstance.addRule('addressfield','Pick up address is required.','required'); formValidatorInstance.addRule('addressfieldto','Destination address is required.','required'); return formValidatorInstance.validate(); } </script> </head> <body> <div id="container"> <div id="content"> <h1> </h1> <form action="form123.php" method="post" onsubmit="return validate(this)"> <p>1 Your details</p> * Name:<br> <input type="text" name="name"><br> * E-mail:<br> <input type="text" name="email"><br> Telephone number:<br> <input type="text" name="tel"><br> Mobile:<br> <input type="text" name="mobile"><br> <p>2 Booking options</p> * No of passengers:<br> <input type="text" name="passenger"><br> <p>3 Journey details</p> <p>* Pick up date: <select name="day" id="day"> <option value= " " selected="selected"> Please select </option> <option value= "1">1</option> <option value= "2">2</option> <option value= "3">3</option> <option value= "4">4</option> <option value= "5">5</option> <option value= "6">6</option> <option value= "7">7</option> <option value= "9">8</option> <option value= "9">9</option> <option value= "10">10</option> <option value= "11">11</option> <option value= "12">12</option> <option value= "13">13</option> <option value= "14">14</option> <option value= "15">15</option> <option value= "16">16</option> <option value= "17">17</option> <option value= "18">18</option> <option value= "19">19</option> <option value= "20">20</option> <option value= "21">21</option> <option value= "22">22</option> <option value= "23">23</option> <option value= "24">24</option> <option value= "25">25</option> <option value= "26">26</option> <option value= "27">27</option> <option value= "28">28</option> <option value= "29">29</option> <option value= "30">30</option> <option value= "31">31</option> </select> <select name="month" id="month"> <option value= " "> Please select </option> <option value= "1">1</option> <option value= "2">2</option> <option value= "3">3</option> <option value= "4">4</option> <option value= "5">5</option> <option value= "6">6</option> <option value= "7">7</option> <option value= "8">8</option> <option value= "9">9</option> <option value= "10">10</option> <option value= "11">11</option> <option value= "12">12</option> </select> <select name="year"> <option value= " "> Please select </option> <option value= "2008">2008</option> <option value= "2009">2009</option> </select> </p> <p>* Pick up time: <input name="hours" type="text" id="hours" value="hours" size="7" maxlength="3" /> <input name="mins" type="text" id="mins" value="mins" size="7" maxlength="3" /> <input name="radio" type="radio" value="AM" /> am <input name="radio" type="radio" value="PM" /> pm</p> <p>* Pick up address including postcode: <textarea name="addressfield" id="addressfield"></textarea> </p> <p>via: <textarea name="via1field" id="via1field"></textarea> </p> <p>via: <textarea name="via2field" id="via2field"></textarea> </p> <p>via: <textarea name="via3field" id="via3field"></textarea> </p> <p>* Destination address: <textarea name="addressfieldto" id="addressfieldto"></textarea> </p> <p>Message: <textarea name="comments" id="comments"></textarea> </p> <p>* indicates these fields must be filled.</p> <p> <input type="submit" name="submit"> </form> </div> <div id="footer"> <p>footer </p> </div> </div> </body> </html> PHP: <title>form123.php</title><?php $recipient = "me@mydomain.co.uk"; $subject = "Contact Form Mail"; $message = "You've received an e-mail through your website mail form: \n"; $message .= "Their details: \n"; $message .= "Name: {$_POST['name']} \n"; $message .= "E-mail: {$_POST['email']} \n"; $message .= "Tel: {$_POST['tel']} \n"; $message .= "Mobile: {$_POST['mobile']} \n"; $message .= "Booking options: \n"; $message .= "No of passengers: {$_POST['passenger']} \n"; $message .= "Pickup date: Day is ".$day." Month is ".$month." Year is ".$year." \n"; $message .= "Pickup time: ".$hours.".".$mins." \n"; $message .= "AM or PM: ".$_POST['radio']." \n"; $message .= "Pickup address: ".$addressfield." \n"; $message .= "Via: ".$via1field." \n"; $message .= "Via: ".$via2field." \n"; $message .= "Via: ".$via3field." \n"; $message .= "Desination address ".$addressfieldto." \n"; $message .= "Message: ".$comments." \n"; $message .= "Price: ".$Price." \n"; $headers = "From: <$recipient> \n"; $headers .= "Reply-To: <{$_POST['email']}>"; if (mail($recipient,$subject,$message,$headers)) { {header("Location: [url="http://www.mydomain.co.uk/index.html")};"]http://www.mydomain.co.uk/index.html")};[/url] } else { echo "<p>Sorry, there was an error and your mail was not sent. Please find an alternative method of contacting the webmaster.</p>"; } ?> Many thanks in advance, John
July 18, 200818 yr Author Even just a pointer at what I may have done wrong. Would be highly appreciated! Is for an urgent job. Please help! John
July 18, 200818 yr Even just a pointer at what I may have done wrong. Would be highly appreciated!Is for an urgent job. Please help! John Only problem I can see is this if (mail($recipient,$subject,$message,$headers)) { {header("Location: [url="http://www.mydomain.co.uk/index.html")};"]http://www.mydomain.co.uk/index.html")};[/url] } else { Try changing that to if (mail($recipient,$subject,$message,$headers)) { header( "Location: http://www.yoursite.co.uk/yourpage.html" ); } else { Obviously change the yoursite.co.uk and yourpage.html Pat
Create an account or sign in to comment