Alesha Posted August 13, 2010 Share Posted August 13, 2010 hi guys i have been building a website and have added a contact form and PHP script to send me a email server side the script works as it it will refresh the pages and display my thank you message but no email ever turns up my email address is correct so there must be somthing else not working <?php /*Email Varibles*/ $emailSubject = 'media-ondemand-contact.php'; $webMaster = '[email protected]'; /*Data Varibles*/ $email = $_POST['email']; $name = $_POST['name']; $radiobuttons = $_POST['radiobuttons']; $where = $_POST['where']; $comments = $_POST['comments']; $newsletter = $_POST['newsletter']; $body = <<<EOD <br><hr><br> Email: $email <br> Name: $name <br> Suggestions Ect: $radiobuttons <br> Where did you hear about us: $where <br> Comments: $comments <br> News Letter Sign up: $newsletter $headers = "$email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); EOD; $theResults = <<<EOD <html> <head> <meta http-equiv="refresh" content="3;//media-ondemand.com"> <title>Sent Message</title> <style type="text/css"> <!-- body { text-align: center; font-family: Verdana, Geneva, sans-serif; font-size: 36px; font-weight: bold; font-variant: normal; color: #666; } --> </style> </head> <body> <p>Thank You</p> <p> Your Message Has Been Sent </p> </body> </html> EOD; echo "$theResults"; ?> the contact page is at www.media-ondemand.com/contact.html Quote Link to comment https://forums.phpfreaks.com/topic/210622-basic-php-script-im-getting-somthing-wrong-please-help/ Share on other sites More sharing options...
Wolphie Posted August 13, 2010 Share Posted August 13, 2010 You can assign variables in a heredoc statement. <?php $subject = 'media-ondemand-contact.php'; $web_master = '[email protected]'; $email = trim($_POST['email']); $name = trim($_POST['name']); $radio = trim($_POST['radiobuttons']); $where = trim($_POST['where']); $comments = trim($_POST['comments']); $newsletter = trim($_POST['newsletter']); $body = <<<EOD <br /><hr /><br /> E-mail: $email <br /> Name: $name <br /> Suggestions Etc: $radiobuttons <br /> Where did you hear about us: $where <br /> Comments: $comments <br /> Newsletter Sign-up: $newsletter EOD; $headers = $email . "\r\n"; $headers .= "Content-type: text/html\r\n"; $success = <<<EOD <html> <head> <meta http-equiv="refresh" content="3;//media-ondemand.com"> <title>Sent Message</title> <style type="text/css"> <!-- body { text-align: center; font-family: Verdana, Geneva, sans-serif; font-size: 36px; font-weight: bold; font-variant: normal; color: #666; } --> </style> </head> <body> <p>Thank You</p> <p> Your Message Has Been Sent </p> </body> </html> EOD; if (mail($web_master, $subject, $body, $headers) !== FALSE) { echo $success; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/210622-basic-php-script-im-getting-somthing-wrong-please-help/#findComment-1098808 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.