Jump to content

[SOLVED] If statement met - go to a new page. HELP!


tqla

Recommended Posts

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";

 

}

 

?>

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.