SuperPaperSam Posted August 27, 2009 Share Posted August 27, 2009 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 Link to comment Share on other sites More sharing options...
justsomeguy Posted August 27, 2009 Share Posted August 27, 2009 If you don't want the page to reload then yeah, you need to use ajax. Link to comment Share on other sites More sharing options...
SuperPaperSam Posted August 30, 2009 Author 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.