Jump to content

Ajax PHP contact form help


Go to solution Solved by whitt,

Recommended Posts

How do you know it was successful? You just return true no matter what.

The mail function returns a boolean, you should use that.

mail($to,$email_subject,$email_body,$headers);
return true;

One other thing I noticed, is headers need to be separated with \r\n, not just \n.

$headers = "From: whitegatescattery.com\n";
$headers .= "Reply-To: email@gmail.com";

As far as the appending error messages in your second code block, it's probably because you do a var_dump(), which sends that output back to the browser.

How do you know it was successful? You just return true no matter what.

The mail function returns a boolean, you should use that.

mail($to,$email_subject,$email_body,$headers);
return true;

One other thing I noticed, is headers need to be separated with \r\n, not just \n.

$headers = "From: whitegatescattery.com\n";
$headers .= "Reply-To: email@gmail.com";

As far as the appending error messages in your second code block, it's probably because you do a var_dump(), which sends that output back to the browser.

How do you mean return true all the time?

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.