simple email form problem
Posted: Mon Dec 27, 2010 3:48 pm
Hi guys I am very new to PHP so please excuse my ignorance. I followed a tutorial on creating a simple enquiry form using php for my portfolio site and am having a slight problem.
The email is sent through without any problems to my inbox but all the information I have placed in the text fields (name,phone,email,comments) does not show at all, neither does the email address show in the from area (it just says unknown user). I have pasted the code below and would appreciate any help I can get. I have created the form in dreamweaver cs5 and have validated it using the validate form tool from within the software.
Cheers and happy festive season to all.
The email is sent through without any problems to my inbox but all the information I have placed in the text fields (name,phone,email,comments) does not show at all, neither does the email address show in the from area (it just says unknown user). I have pasted the code below and would appreciate any help I can get. I have created the form in dreamweaver cs5 and have validated it using the validate form tool from within the software.
Cheers and happy festive season to all.
Code: Select all
<?php
/* Comment -- Subject and email variables */
$emailSubject = 'Gavin Sinclair Enquiry !';
$webMaster = 'enquiry@gavinsinclair.com.au';
/* Gathering data variables*/
$nameField = $_POST['name'];
$phoneField = $_POST['phone'];
$emailField = $_POST['email'];
$commentsField = $_POST['comments'];
$body = <<<EOD
<br><hr><br>
name: $name <br>
phone: $phone <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 render as html*/
$theResults = <<<EOD
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gavin Sinclair Graphic designer: Thank you</title>
<style type="text/css">
#thankyou_enquiry {
font-family: "Arial Black", Gadget, sans-serif;
font-size: 14px;
color: #FFF;
text-align: center;
height: 110px;
width: 500px;
margin-right: auto;
margin-left: auto;
}
</style>
<link href="css/screen.css" rel="stylesheet" type="text/css" />
</head>
<body bgcolor="#000000" text="#FFFFFF" link="#FFCC00" vlink="#FFCC00" alink="#FFCC00" topmargin="20">
<div id="thankyou_enquiry">
<p>Thank you for your enquiry, I will be in contact with you shortly.</p>
<p><a href="index.html">Back to Home Page</a></p>
</div>
</body>
</html>
EOD;
echo "$theResults";
?>