nickb_53 Posted May 28, 2008 Share Posted May 28, 2008 After submitting a form how to replace the echo with a redirect to thankyou.html page? ___________________________________________________________________________ <form action="process_form2.php" method="post" enctype="application/x-www-form-urlencoded" name="form1"> <input type='text' name='email'> </label> <label> <input type="submit" name="Add" id="Add" value="Add Email"> </label> </form> ___________________________________________________________________________ process_form2.php below <?PHP $email = $_POST['email']; $subject = "Mailing List"; $message = $_POST['message']; $target_address = '[email protected]'; $headers = "From: ".$email."\r\n". "X-Mailer: php"; if (mail($target_address, $subject, $message, $headers)) { echo("Thank you for contacting us, we will get back to you as soon as we can xxx bye"); } else{ echo("Sorry your message delivery failed. Please try back later"); die(); } ?> Link to comment https://forums.phpfreaks.com/topic/107654-solved-how-after-form-proccessed-replace-echo-with-a-redirect-to-thankyou-page/ Share on other sites More sharing options...
paul2463 Posted May 28, 2008 Share Posted May 28, 2008 if (mail($target_address, $subject, $message, $headers)) { header('Location: thankyou.html'); exit; } Link to comment https://forums.phpfreaks.com/topic/107654-solved-how-after-form-proccessed-replace-echo-with-a-redirect-to-thankyou-page/#findComment-551863 Share on other sites More sharing options...
nickb_53 Posted May 28, 2008 Author Share Posted May 28, 2008 Thank You you solved it great Slowly getting the hang of php thanks to this forum Link to comment https://forums.phpfreaks.com/topic/107654-solved-how-after-form-proccessed-replace-echo-with-a-redirect-to-thankyou-page/#findComment-551874 Share on other sites More sharing options...
paul2463 Posted May 28, 2008 Share Posted May 28, 2008 if it works how you want it can you click the "SOLVED" button? Link to comment https://forums.phpfreaks.com/topic/107654-solved-how-after-form-proccessed-replace-echo-with-a-redirect-to-thankyou-page/#findComment-551878 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.