Jump to content

Simple Form Question


jpkuelho

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

Archived

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

×
×
  • Create New...