PDA

View Full Version : Contact Box not working (.PHP) Help!



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>&nbsp;</span><input class="submit" type="submit" name="contact_submitted" value="submit" /></p>

Any ideas?

Thomas
26-01-2011, 07:55 PM
worked it out after 2 hours of redoing the whole page, it has so many errors :P

Mark
26-01-2011, 08:57 PM
Glad you got there in the end :P

Thomas
27-01-2011, 07:19 AM
Glad you got there in the end :P

ty :P considering im only 13 i think my coding isn't to bad, but i do make mistakes here and there.

Trinity
27-01-2011, 03:29 PM
ty :P considering im only 13 i think my coding isn't to bad, but i do make mistakes here and there.

Age is unimportant, I've met 11 and 12 year olds who have insane PHP and Java skills.

Thomas
27-01-2011, 04:04 PM
Age is unimportant, I've met 11 and 12 year olds who have insane PHP and Java skills.

i only got dreamweaver on saturday, well i'm pleased with what i know :P

Want to hide these adverts? Register an account for free!