Jump to content

Basic PHP script Im getting somthing wrong please help


Alesha

Recommended Posts

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

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;
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.