CroNiX Posted March 6, 2015 Share Posted March 6, 2015 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. Link to comment https://forums.phpfreaks.com/topic/295049-ajax-php-contact-form-help/page/2/#findComment-1507792 Share on other sites More sharing options...
whitt Posted March 6, 2015 Author Share Posted March 6, 2015 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? Link to comment https://forums.phpfreaks.com/topic/295049-ajax-php-contact-form-help/page/2/#findComment-1507795 Share on other sites More sharing options...
whitt Posted March 6, 2015 Author Share Posted March 6, 2015 Am i close to fixing this at least? Link to comment https://forums.phpfreaks.com/topic/295049-ajax-php-contact-form-help/page/2/#findComment-1507799 Share on other sites More sharing options...
whitt Posted March 6, 2015 Author Share Posted March 6, 2015 I just checked the JS console i have thisPOST http://localhost/contact_form/bin/contact_me.php 500 (Internal Server Error) Link to comment https://forums.phpfreaks.com/topic/295049-ajax-php-contact-form-help/page/2/#findComment-1507800 Share on other sites More sharing options...
whitt Posted March 7, 2015 Author Share Posted March 7, 2015 okk i think the issue is my ajax url i have the form working then the php file is in the same directory but not when in the bin folder form.zip Link to comment https://forums.phpfreaks.com/topic/295049-ajax-php-contact-form-help/page/2/#findComment-1507838 Share on other sites More sharing options...
whitt Posted March 8, 2015 Author Share Posted March 8, 2015 fixed it Link to comment https://forums.phpfreaks.com/topic/295049-ajax-php-contact-form-help/page/2/#findComment-1507884 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.