PHP submit form
Posted: Sun Feb 15, 2009 5:47 am
Hi Guys,
First time here so I hope someone can help me, I have only just begun playing with php coding and have created a form, the following code seems to send the email ok but the result is the format after the code shown below.....I am not seeming to get any text that I have filled in in the form text fields when the email comes in.
Any help would be greatly appreciated.
Code:
the email result:
Email:
Name:
Company Name: name
Arrival Date: date
Home Phone: phone
Mobile Phone: phone
Fax:
County:
Service:
Suburbs:
Comments:
First time here so I hope someone can help me, I have only just begun playing with php coding and have created a form, the following code seems to send the email ok but the result is the format after the code shown below.....I am not seeming to get any text that I have filled in in the form text fields when the email comes in.
Any help would be greatly appreciated.
Code:
Code: Select all
<?php
/* this is a comment = Subject and email variables */
$emailSubject = 'Enquiry Form';
$webMaster = 'gavinsmc@bigpond.net.au';
/* Gathering data variables */
$nameField = $_POST['name'];
$emailField = $_POST['email'];
$CompanyNameField = $_POST['CompanyName'];
$arrivalDateField = $_POST['arrivalDate'];
$homePhoneField = $_POST['homePhone'];
$mobilePhoneField = $_POST['mobilePhone'];
$faxField = $_POST['fax'];
$countryField = $_POST['country'];
$serviceField = $_POST['service'];
$suburbsField = $_POST['suburbs'];
$commentsField = $_POST['comments'];
$body = <<<EOD
<br><hr><br>
Email: $email <br>
Name: $name <br>
Company Name: $Company name <br>
Arrival Date: $arrival date <br>
Home Phone: $home phone <br>
Mobile Phone: $mobile phone <br>
Fax: $fax <br>
County: $country <br>
Service: $service <br>
Suburbs: $suburbs <br>
Comments: $comments <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r/n";
$success = mail($webMaster, $emailSubject, $body, $headers);
/* Resuklts rendered as html */
$theResults = <<<EOD
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>
<body>
<table width="522" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>Thank you for your enquiry your email has been sent, we will be in contact very soon.</td>
</tr>
</table>
</body>
</html>
EOD;
echo "$theResults";
?>
the email result:
Email:
Name:
Company Name: name
Arrival Date: date
Home Phone: phone
Mobile Phone: phone
Fax:
County:
Service:
Suburbs:
Comments: