SuperPaperSam 0 Posted August 27, 2009 Report Share Posted August 27, 2009 (edited) I would like to show a message after someone sends me a email. Stating whether there email was sent or not. Right now they are sent to a new page.I don't want the page to reload. And if possible I want to pick where the text would show up.This is the PHP I'm using now. <?php $emailsubject = 'Contact'; $webMaster = 'youwillnotsendmespam@blah.blah'; $nameField = $_POST ['name']; $emailField = $_POST ['email']; $messageField = $_POST ['message']; $body = <<<EOD <hr> Name: $nameField <br> Email: $emailField <br> Message: $messageField <br> <hr> EOD; $headers = "From: $emailField\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailsubject, $body, $headers); $theResults = <<<EOD <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <div> <div align="left">Thank you for contacting me!</div> </div> </body> </html> EOD; echo "$theResults" ?> Would this code work without a reload? Or do I have to use AJAX? <?php $emailsubject = 'Contact'; $webMaster = 'youwillnotsendmespam@blah.blah'; $nameField = $_POST ['name']; $emailField = $_POST ['email']; $messageField = $_POST ['message'];</font> $body = <<<EOD <hr> Name: $nameField <br> Email: $emailField <br> Message: $messageField <br> <hr> EOD; $headers = "From: $emailField\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailsubject, $body, $headers); if ($success) echo "Your message has been sent. I will get back to you as soon as possible."; else echo "There has been a error! Make sure you have a working internet connection and try again."; Any help would be very helpful.Thanks Edited August 27, 2009 by SuperPaperSam Quote Link to post Share on other sites
justsomeguy 1,135 Posted August 27, 2009 Report Share Posted August 27, 2009 If you don't want the page to reload then yeah, you need to use ajax. Quote Link to post Share on other sites
SuperPaperSam 0 Posted August 30, 2009 Author Report Share Posted August 30, 2009 I posted a new topic (Look at it) on the AJAX website a few days ago. But I have not received a response yet .So I was hoping that one of you guys/girls could help me figure out how to accomplish this.Any help would be appreciated!Thanks,SuperPaperSam Quote Link to post Share on other sites
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.