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@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. Quote 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@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? Quote 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? Quote 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 (edited) I just checked the JS console i have thisPOST http://localhost/contact_form/bin/contact_me.php 500 (Internal Server Error) Edited March 6, 2015 by whitt Quote 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 Quote 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...
Solution whitt Posted March 8, 2015 Author Solution Share Posted March 8, 2015 fixed it Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.