Jump to content

Ajax PHP contact form help


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 protected]";

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 protected]";

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?

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.