Jump to content

Form Emailer will not reach success page


cfgcjm

Recommended Posts

can use a bit of dirty html code but some browsers may have this blocked

 

<?
session_start();
$name = $_POST["name"];
$email = $_POST["email"];
$person = $_POST["person"];
$reason = $_POST["reason"];
$today = date("d, M Y");
$recipient = "millercj@etown.edu";
$subject = "Prayer Request";
$forminfo ="From: $name\nEmail: $email\nForm Submitted: $today\nPerson to add: $person\nReason: $reason\n\n";
$sent = mail($recipient, $subject, $forminfo, "From: $email");
if($sent)
{
  echo '<meta http-equiv="refresh" content="0;URL=http://www.stjohnsuccjonestown.org/portal/requestsuccess.php">';
else
{
  echo '<meta http-equiv="refresh" content="0;URL=http://www.stjohnsuccjonestown.org/portal/requestno.php">';
}
?>

 

 

Liam

 

I have an off the wall idea...

 

Use a variable.

 

If message sent, $Success=1, message failed, $Success=0.

 

Then down in the code, use if statements.

if($Success==1)
{
     $ShowForm=0; 
     Do this
}

if($Success==0)
{
     $ShowForm=1; //Show the form again with the errors
     Do this
}

For the form processing, try action to self and at the top of the page, try an isset for the submit button and 'include' the error checking and then if no errors, change the variable values.

 

if($ShowForm==1)
{
     Show the form
}

else
{
     Don't show the form. Show something else.
}

 

Confused yet?

 

Hopefully this helped.

  Quote

I have an off the wall idea...

 

Use a variable.

 

If message sent, $Success=1, message failed, $Success=0.

 

Then down in the code, use if statements.

if($Success==1)
{
     $ShowForm=0; 
     Do this
}

if($Success==0)
{
     $ShowForm=1; //Show the form again with the errors
     Do this
}

For the form processing, try action to self and at the top of the page, try an isset for the submit button and 'include' the error checking and then if no errors, change the variable values.

 

if($ShowForm==1)
{
     Show the form
}

else
{
     Don't show the form. Show something else.
}

 

Confused yet?

 

Hopefully this helped.

 

 

if you look back through the thread i echo'ed stuff back and it was checking if it had sent or not as it got to success and echo'ed success but it was the header() that wasn't working nor returning an error message.

 

 

Liam

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.