Jump to content

Simple Form Question


jpkuelho
 Share

Recommended Posts

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...