think-digitally Posted June 12, 2008 Share Posted June 12, 2008 Hi. I have a contact form. When the form is submitted, I want it to forward to a sent page. Can anyone show me how I would do this with the code. Heres the code <?php if(isset($_POST['submit'])) { $to = "[email protected]"; $subject = "Print Requet - David Clapp Photography"; $name_field = $_POST['name']; $email_field = $_POST['email']; $printname = $_POST['printname']; $message = $_POST['message']; $option = $_POST['radio']; $option2 = $_POST['radio2']; $dropdown = $_POST['drop_down']; $body = "From: $name_field\n E-Mail: $email_field\n Photo Name: $printname\n Postage: $option\n Payment: $option2\n Print Size: $dropdown\n Message:\n $message\n"; echo "Data has been submitted to $to!"; mail($to, $subject, $body); } else { echo "Error, Please try again later"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/109974-solved-how-can-i/ Share on other sites More sharing options...
wildteen88 Posted June 12, 2008 Share Posted June 12, 2008 What do want to happen on the sent page? To redirect a user use header: header('Location: page_to_be_redirect_to.php'): Quote Link to comment https://forums.phpfreaks.com/topic/109974-solved-how-can-i/#findComment-564320 Share on other sites More sharing options...
think-digitally Posted June 12, 2008 Author Share Posted June 12, 2008 dont mean to come accross stupid, but were in the script would I place the header? Quote Link to comment https://forums.phpfreaks.com/topic/109974-solved-how-can-i/#findComment-564325 Share on other sites More sharing options...
wildteen88 Posted June 12, 2008 Share Posted June 12, 2008 I presume you want the user to be redirected after the email has been sent? If so add it after you call mail function. Quote Link to comment https://forums.phpfreaks.com/topic/109974-solved-how-can-i/#findComment-564331 Share on other sites More sharing options...
think-digitally Posted June 12, 2008 Author Share Posted June 12, 2008 Fantastic works. Thankyou. Quote Link to comment https://forums.phpfreaks.com/topic/109974-solved-how-can-i/#findComment-564333 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.