Thomas
26-01-2011, 05:44 PM
Im using this code to get my contact box to sent the message to my email, but when i click send it just delets the text i put in the boxes and doesn't sent the message to my email or redirect to the confirming the message has been sent page if you get what i mean.
<?php
/* Email Variables */
$emailSubject = 'contact!'; /*Make sure this matches the name of your file*/
$webMaster = '[email protected]';
/* Data Variables */
$name = $_POST['your_name'];
$email = $_POST['you_email'];
$message = $_POST['your_enquiry'];
$body = <<<EOD
<br><hr><br>
Name: $name <br>
Email: $email <br>
Comments: $comments <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body,
$headers);
/* Results rendered as HTML */
$theResults = <<<EOD
<html>
<head>
<title>sent message</title>
<meta http-equiv="refresh" content="3;URL=http://www.cheapgp.net/index.html">
<style type="text/css">
<!--
body {
background-color: #444; /* You can edit this CSS to match your website*/
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 20px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #fec001;
text-decoration: none;
padding-top: 200px;
margin-left: 150px;
width: 800px;
}
-->
</style>
</head>
<div align="center">The message has been successfully sent.</div>
</div>
</body>
</html>
EOD;
echo "$theResults";
?>
This is the contact me box im using:
<h1>Contact Us </h1>
<form action="contact.php" method="post">
<div class="form_settings">
<p><span>Name</span><input class="contact" type="text" name="your_name" value="" /></p>
<p><span>Email Address</span><input class="contact" type="text" name="your_email" value="" /></p>
<p><span>Message</span><textarea class="contact textarea" rows="8" cols="50" name="your_enquiry"></textarea></p>
<p style="padding-top: 15px"><span> </span><input class="submit" type="submit" name="contact_submitted" value="submit" /></p>
Any ideas?
<?php
/* Email Variables */
$emailSubject = 'contact!'; /*Make sure this matches the name of your file*/
$webMaster = '[email protected]';
/* Data Variables */
$name = $_POST['your_name'];
$email = $_POST['you_email'];
$message = $_POST['your_enquiry'];
$body = <<<EOD
<br><hr><br>
Name: $name <br>
Email: $email <br>
Comments: $comments <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body,
$headers);
/* Results rendered as HTML */
$theResults = <<<EOD
<html>
<head>
<title>sent message</title>
<meta http-equiv="refresh" content="3;URL=http://www.cheapgp.net/index.html">
<style type="text/css">
<!--
body {
background-color: #444; /* You can edit this CSS to match your website*/
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 20px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #fec001;
text-decoration: none;
padding-top: 200px;
margin-left: 150px;
width: 800px;
}
-->
</style>
</head>
<div align="center">The message has been successfully sent.</div>
</div>
</body>
</html>
EOD;
echo "$theResults";
?>
This is the contact me box im using:
<h1>Contact Us </h1>
<form action="contact.php" method="post">
<div class="form_settings">
<p><span>Name</span><input class="contact" type="text" name="your_name" value="" /></p>
<p><span>Email Address</span><input class="contact" type="text" name="your_email" value="" /></p>
<p><span>Message</span><textarea class="contact textarea" rows="8" cols="50" name="your_enquiry"></textarea></p>
<p style="padding-top: 15px"><span> </span><input class="submit" type="submit" name="contact_submitted" value="submit" /></p>
Any ideas?