tqla Posted March 20, 2007 Share Posted March 20, 2007 Hi, I would like to send the viewer to a new page when "if" conditions are met. Here is the last bit of the code. It works fine and the $message is echo'd but I'd like to send them to a new page instead. Is this possible? Thanks. ... $message="<b>All Fields are valid. <br> We have recieved your message. Thank you!<b>"; $name = "$_POST[name]"; $email = "$_POST"; $messages = "$_POST[messages]"; include("db.php"); mysql_query("INSERT INTO contacts(name, email, messages) VALUES('$name', '$email', '$messages') ") or die(mysql_error()); } echo "$message"; } ?> Link to comment https://forums.phpfreaks.com/topic/43572-solved-if-statement-met-go-to-a-new-page-help/ Share on other sites More sharing options...
suzzane2020 Posted March 20, 2007 Share Posted March 20, 2007 You can use the header function header("location: filename"); place this at the end Link to comment https://forums.phpfreaks.com/topic/43572-solved-if-statement-met-go-to-a-new-page-help/#findComment-211623 Share on other sites More sharing options...
AndyB Posted March 21, 2007 Share Posted March 21, 2007 Actually, once you output anything to the browser, the header function will fail. Better to either give them a 'success - click here' hyperlink or use the header() function to take them to a 'thank you' page where you can display your success message. Link to comment https://forums.phpfreaks.com/topic/43572-solved-if-statement-met-go-to-a-new-page-help/#findComment-211716 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.