dbooker24 Posted December 31, 2008 Share Posted December 31, 2008 I want to change my php form handler. Right now when someone hits submit it writes out a thank you using the code below: $recipient="[email protected]"; $subject="Registration Information"; error_reporting(0); if (mail($recipient, $subject, $msg)){ echo "<h1>Thank You</h1><p>Your form has been submitted!.:</p>\n"; echo nl2br($input); } else echo "An error occurred and the message could not be sent."; } else echo "Bad request method"; Instead i would like it to just redirect them to another web page. How do I do this? Thanks for helping a noob to php. Quote Link to comment https://forums.phpfreaks.com/topic/139043-noob-needs-help/ Share on other sites More sharing options...
.josh Posted December 31, 2008 Share Posted December 31, 2008 $recipient="[email protected]"; $subject="Registration Information"; error_reporting(0); if (mail($recipient, $subject, $msg)){ header("Location: somepage.php"); exit(); } else echo "An error occurred and the message could not be sent."; } else echo "Bad request method"; Note: that will only work if there is no output before that header call. If you have output before that header call, refer to the sticky about headers in this forum. Quote Link to comment https://forums.phpfreaks.com/topic/139043-noob-needs-help/#findComment-727213 Share on other sites More sharing options...
revraz Posted December 31, 2008 Share Posted December 31, 2008 Or just use a HTML or JS redirect. Quote Link to comment https://forums.phpfreaks.com/topic/139043-noob-needs-help/#findComment-727216 Share on other sites More sharing options...
dbooker24 Posted December 31, 2008 Author Share Posted December 31, 2008 Man that was fast! OK I am still learning how html and php interact. I could just write out an html redirect? I know how to do that but anything in paticular I need to know? Quote Link to comment https://forums.phpfreaks.com/topic/139043-noob-needs-help/#findComment-727221 Share on other sites More sharing options...
dbooker24 Posted December 31, 2008 Author Share Posted December 31, 2008 iT WORKS YOU GUYS ARE AWSOME THANS FOR THE HELP! Quote Link to comment https://forums.phpfreaks.com/topic/139043-noob-needs-help/#findComment-727225 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.