jpkuelho Posted August 17, 2009 Share Posted August 17, 2009 I've made a contact form in contact.php the form code has as follows// send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");// redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.php\">";}else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.php\">";}?>But since ok.php and error.php are the same as contact.php but with a message on top saying if the form was submitted or not, I would like to know if there's a way I can make that message display on contact.php itselfThanks for your attetion Link to comment Share on other sites More sharing options...
Synook Posted August 17, 2009 Share Posted August 17, 2009 You can always print a message depending on a querystring variable, e.g. (by the way it is better to use location header rather than metas): if ($success) header("location:contact.php?status=ok");else header("location:contact.php?status=error"); And then on contact.php if (isset($_GET['status'])) { if ($_GET['status'] == "ok") echo $ok_message; else echo $error_message;} Link to comment Share on other sites More sharing options...
jpkuelho Posted August 19, 2009 Author Share Posted August 19, 2009 I don't get it , if I put that code on contact.php the page doesn't load at alland where I declare $ok_message and $error_message ? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.