I think its very simple but I am confused in coding this script. I want a contactus.php page where users enter/input their DATA, and when they hit submit button, the data will sent to my email and if those users enter a value of YES will redirect to thankyou.htm page and if they enter NO then their data submit to my email and they didn't redirect to thankyou.htm page. The page contains the folowing values; Name: [Text Box] Father's Name: [Text Box] Age: [Text Box] Sex: [MALE/ FEMALE Options] Address: [Text area option] Marital Status: [Single/Married/Divorced options] Another Option: [Yes/No options] <--- Here if user select Yes then after submitting the form, he should redirect to thankyou.htm otherwise no redirect. It will really appreciated if you enter a Capatcha varification for the page. Thankyou very much for guiding me. Best regards
I have one Captcha script. But why to do it complex way anyway. Just do some click and make a form on JotForm - http://www.jotform.com/.
Thanks for the link: but I want my own script rather to use any other's server for collecting the information and submitting to my email.
Not only Captcha, but a complete contactus form script. If you provide me I will be very thankful to you
Make google your friend Just google this contact us script with captcha. If you need more help check this link http://www.thewebhelp.com/php/php_contact_form_with_image_validation If you need any further assistance just PM me.
Use an if statement. <select name="select"><option value="yes">Yes</option><option value="no">No</option></select> Code (markup): And, for the contactform page: if($_POST['select'] == 'yes'){ //redirect //mail( }else{ //something else } Code (php): Hope that gelps
Thanks Peter Anderson, Can you make me a complete contactus.php page ? All values are in the OP. Thankyou for help. Please use this email for submitting the data: Please use this page for redirection: thankyou.htm
I don't normally do free code, but since it's easy, here you go. form.php <?php # you can add your header here # our functions function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { show_error($problem); } return $data; } function show_error($myError) { $content = '<h2> Error processing your form.</h2> <p> We are sorry, but we experienced an error while submitting your form.</p> <p> Error:<br /> '.$myError.'</p>'; } switch($_GET['action']){ case "thanks": $content = '<h2> Form processed!</h2> <p> Your forum submission has been processed by our online form processing service.</p> <p> </p> <p> Thanks!</p> <p> <a href="http://www.regyourdomain.com">For domain names, visit RegYourDomain.</a></p>'; break; case "confirm": $myemail = 'me@me.com'; //write your email address between the ' ' $uname = check_input($_POST['name'], "Specify your full name"); $dad = check_input($_POST['dad'], "Let us know your fathers name"); $age = check_input($_POST['age'], "What age are you?"); $address = check_input($_POST['address'], "Please input your address"); $marry = check_input($_POST['marry'], "Specify your marital status."); $option = check_input($_POST['option']); $message = "A new form has been submitted from your website. Name: $uname Fathers name: $dad Age: $age Address: $address Marital Option: $option Thanks."; if($_POST['select'] == 'No'){ $subject = 'A new form has been processed'; mail($myemail, $subject, $message); $content = '<h2> Thanks!</h2> <p> Thanks for submitting your form.</p> <p> Redirecting.....</p> <meta http-equiv="refresh" content="0;url=?action=thanks" />'; mail($myemail, $subject, $message); }else{ $content = '<meta http-equiv="refresh" content="0;url=?action=thanks" />'; } break; default: $content = '<h2> Submit your details</h2> <form action="form.php?action=submit" method="post" name="submit"> <table border="1" cellpadding="1" cellspacing="1" style="width: 100%"> <tbody> <tr> <td> Name:</td> <td> <input name="name" type="text" /></td> </tr> <tr> <td> Father\'s Name:</td> <td> <input name="dad" type="text" /></td> </tr> <tr> <td> Age:</td> <td> <input name="age" type="text" /></td> </tr> <tr> <td> Sex:</td> <td> <select name="sex"><option selected="selected" value="M">Male</option><option value="F">Female</option></select></td> </tr> <tr> <td> Address:</td> <td> <textarea cols="40" name="address"></textarea></td> </tr> <tr> <td> Marital Status:</td> <td> <select name="marry"><option selected="selected" value="Married">Married</option><option value="Single">Single</option><option value="Engaged">Engaged</option><option value="Divorced">Divorced</option><option value="With partner">With partner</option></select></td> </tr> <tr> <td> Option:</td> <td> <select name="option"><option selected="selected" value="Yes">Yes</option><option value="No">No</option></select></td> </tr> <tr> <td> </td> <td> <input name="submit" type="button" value="Submit my Form!" /></td> </tr> </tbody> </table> </form>'; break; } echo $content; # you can add your footer here ?> Code (php): There isn't any captcha, but you can add it yourself.