Hi All, I am front-end web designer so when it comes to php, I often struggle so I hope someone can help me here. I am trying to tweak a form written in PHP but do not seem to suceed... Basically, I have added fields to the form but cannot manage to edit the related php files so the data gets checked and validated and then send to me by email. I would also like the users to be redirected onto a thank you page once they submit the form I have attached the different files but also pasted the codes below Hope someone call help me!!!! Pierrick419 Here is the form itself ------------------------ <?php include("options.php"); if($_GET["msg"] == "1") $status = "<span style=\"background: #fff; color: #f00\">ERROR: You must enter a subject</span>"; elseif($_GET["msg"] == "2") $status = "<span style=\"color: #f00\">ERROR: You must enter a name</span>"; elseif($_GET["msg"] == "3") $status = "<span style=\"color: #f00\">ERROR: You must enter an email address</span>"; elseif($_GET["msg"] == "4") $status = "<span style=\"color: #f00\">ERROR: You must enter a <ins>valid</ins> email address</span>"; elseif($_GET["msg"] == "5") $status = "<span style=\"color: #f00\">ERROR: You must enter a message</span>"; elseif($_GET["msg"] == "6") $status = "<span style=\"background: #fff; color: #f00\">ERROR: Your message cannot be more than ".$maximum_characters." characters</span>"; elseif($_GET["msg"] == "7") $status = "<span style=\"background: #fff; color: #0a0\">Your message has been successfully sent</span>"; else $status = "<span style=\"background: #fff; color: #00f\">Please fill in the below form before uploading your photos</span>"; ?> <form action="formsend.php" method="post"> <strong><?=$status?></strong> <br /><br /> <strong>Name</strong>: <? if($name_required == true) echo "<span style=\"background: #fff; color: #f00\">*</span>"; else echo "" ?><br /> <input maxlength="80" name="name" size="51" type="text" /> <br /> <strong>Student</strong>: <span style="background: #fff; color: #f00">*</span><br /> <input type="radio" name="student" value="yes" checked>Yes <input type="radio" name="student" value="no"> No <br /> <strong>If Yes, your school (please write in):</strong><? if($school_required == true) echo "<span style=\"background: #fff; color: #f00\">*</span>"; else echo "" ?><br /> <input maxlength="80" name="school" size="51" type="text" /> <br /> <strong>Your Email Address</strong>: <? if($email_address_required == true) echo "<span style=\"background: #fff; color: #f00\">*</span>"; else echo "" ?><br /> <input maxlength="200" name="email" size="51" type="text" /><br /> <strong>Phone number:</strong><br /> <input maxlength="80" name="phone" size="51" type="text" /> <br /> <strong>Chosen template:</strong> <select name="template"> <option value="" selected="selected">--- Select ---</option> <option value="Template1">Template 1</option> <option value="Template2">Template 2</option> <option value="Template3">Template 3</option> <option value="Template4">Template 4</option> <option value="Template5">Template 5</option> <option value="Template6">Template 6</option> <option value="Template7">Template 7</option> <option value="Template8">Template 8</option> <option value="Template9">Template 9</option> <option value="Template10">Template 10</option> </select> <br /> <strong>Payment type:</strong> <select name="payment"> <option value="" selected="selected">--- Select ---</option> <option value="Paypal">Paypal</option> <option value="Cheque">Cheque</option> </select> <br /> <strong>How heard:</strong> <select name="heard"> <option value="" selected="selected">--- Select ---</option> <option value="Template1">Word to mouth</option> <option value="Template2">Flyer/Poster</option> <option value="Template3">Search engine</option> <option value="Template4">Newspaper</option> <option value="Template5">TV</option> <option value="Template6">Radio</option> <option value="Template7">Other</option> </select> <br /> <strong>Comments</strong>: <? if($message_required == true) echo "<span style=\"background: #fff; color: #f00\">*</span>"; else echo "" ?><br /> <textarea cols="38" name="message" rows="3">Write in here if you have comments about the template you have chosen or about anything else related to this request</textarea><br /> <strong>I have read and accept the Terms and Conditions</strong>: <span style="background: #fff; color: #f00">*</span><br /> <input type="radio" name="terms" value="yes" unchecked>Yes <input type="radio" name="terms" value="no">no <br /><br /> An <span style="background: #fff; color: #f00">*</span> indicates a required field <input type="submit" value="Send Message"/> Powered by: <a href="http://hypersilence.net" title="Silentum FormSend v1.5.0">Silentum FormSend v1.5.0</a><br /><br /> All messages are sent directly to:<br /><?=$email_address?>. </form> ******************************************************** Here is the form_send.php file <? /* Silentum FormSend v1.5.0 Modified January 21, 2008 formsend.php copyright 2005-2008 "HyperSilence" */ include("options.php"); $today = date("F d, Y / h:i:sa"); $subject = $HTTP_POST_VARS["subject"]; $name = $HTTP_POST_VARS["name"]; $email = $HTTP_POST_VARS["email"]; $check = $HTTP_POST_VARS["message"]; $school = $HTTP_POST_VARS["school"]; $message = $today."\n\nName: ".strip_tags(stripslashes($HTTP_POST_VARS["name"]))."\nEmail Address: ".strip_tags(stripslashes($HTTP_POST_VARS["email"]))."\nMessage: ".strip_tags(stripslashes($HTTP_POST_VARS["message"]))."\nIP Address: ".$_SERVER["REMOTE_ADDR"]; $headers = "From: ".$email."" . "\r\n" . "Reply-To: ".$email."" . "\r\n" . "X-Mailer: PHP/" . phpversion(); if(preg_match("/^[\.0-9a-z_-]{1,}@[\.0-9a-z-]{1,}\.[a-z]{1,}$/si", $email)) $valid = "1"; else $valid = "0"; /*if($subject == "") { header("Location: ".$form_file."?msg=1"); exit; }*/ if($school == "") { header("Location: ".$form_file."?msg=1"); exit; } if($name_required == true && $subject != "" && $name == "") { header("Location: ".$form_file."?msg=2"); exit; } elseif($email_address_required == true && $subject != "" && $email == "") { header("Location: ".$form_file."?msg=3"); exit; } elseif($email_address_required == true && $valid == "0") { header("Location: ".$form_file."?msg=4"); exit; } elseif($message_required == true && $subject != "" && $check == "") { header("Location: ".$form_file."?msg=5"); exit; } elseif(strlen($message) >= $maximum_characters && $subject != "") { header("Location: ".$form_file."?msg=6"); exit; } else { mail($email_address, $subject, $message, $headers, $school); header("Location: ".$form_file."?msg=7"); } ?> ******************************************************* Here is the options_php file <? /* Silentum FormSend v1.5.0 Modified January 21, 2008 options.php copyright 2005-2008 "HyperSilence" */ $form_file = "form_page.php"; // Change this to the page that includes the form $email_address = "pierrick@lalydesign.co.uk"; // Change this to your email address $name_required = true; // Leave this at true if you want the sender's name to be required; otherwise, change it to false $school_required = false; $email_address_required = true; // Leave this at true if you want the sender's email address to be required; otherwise, change it to false $maximum_characters = 255; // The maximum number of characters allowed in a message $message_required = true; // Leave this at true if you want a message to be required; otherwise, change it to false ?> THANKS Pierrick419
Change this part for redirect else { mail($email_address, $subject, $message, $headers, $school); header("Location: ".$form_file."?msg=7"); to else { mail($email_address, $subject, $message, $headers, $school); header("Location: http://www.yourdomain.com/yourpage.html"); for other problems please PM me with detailed information, screenshots and scripting!