zinctek Posted November 14, 2009 Share Posted November 14, 2009 Hello i have got a problem with a small script i have made. its a simple contact form that once its been submitted it just says thank you contacting us......... but what i want it to do is redirect to another page after they have submited the form. Below you will find the code. Anyone know how to do add the last part in? thank you Dave <?php if(isset($_POST['submit'])) { $to = "[email protected]"; $subject = "message from Web Site"; $name = $_POST['name']; $email1 = $_POST['email1']; $email2 = $_POST['email2']; $telephonenumber = $_POST['telephonenumber']; $message = $_POST ['message']; foreach($_POST as $value) { $check_msg .= "Checked: $value\n"; } $body = " From: $name\n Email: $email1\n Email (check): $email2\n Telephone: $telephonenumber\n Message : $message\n " ; echo "Thank You for getting in touch with our Us. <br><br>We will try and contact you with in the next 24 hours. <br><br> We Understant that your enqurie is important so we will get on to this as soon as we can.<br><br> "; mail($to, $subject, $body); } else { echo "Error on site please contact the administrator!"; } ?> Link to comment https://forums.phpfreaks.com/topic/181474-contact-form-problem/ Share on other sites More sharing options...
ngreenwood6 Posted November 14, 2009 Share Posted November 14, 2009 Depends on how you want to redirect. If you want them to see the page for a few seconds you can use the meta refresh (change the content number for different times): *not php code <META http-equiv="refresh" content="5;URL=http://www.yoururl.com"> if you want them immediately redirected you can use the header() function (note this must be done before the headers are sent or you will get an error): <?php header("location:http://wwwyoururl.com"); ?> Link to comment https://forums.phpfreaks.com/topic/181474-contact-form-problem/#findComment-957298 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.