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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.