Hi All - I have a form and I want the two places in which the enquirer types their email adress in (Field emailAddress and email2) to check that the email address values are the same and send the form - if not the same just say some kind of error message eg your email address does not match... blah
Im struggling and have tried and failed, it may just be that I dont know at what point to insert a compare type php string. All suggestions will be most appreciated.
<?php
if(isset($_POST['name']))
{
$to = 'me@adomain.com';
// subject
$subject = 'Website enquiry';
// message
$message = '
<html>
<head>
<title>Website Enquiry</title>
</head>
<body>
<table>
<tr>
<td>Name : </td><td> '.$_POST['name'].'</td>
</tr>
<tr>
<td>Company Name : </td><td> '.$_POST['coName'].'</td>
</tr>
<tr>
<td>Email Address : </td><td> '.$_POST['emailAddress'].'</td>
</tr>
<tr>
<td>Confirm Email address : </td><td> '.$_POST['email2'].'</td>
</tr>
<tr>
<tr>
<td>Contact Tel No : </td><td> '.$_POST['contactNo'].'</td>
</tr>
<td>How you found us : </td><td> '.$_POST['findUs'].'</td>
</tr>
<tr>
<td>Message : </td><td> '.$_POST['message'].'</td>
</tr>
</table>
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: '. $_POST['emailAddress'] . "\r\n";
// Mail it
@mail($to, $subject, $message, $headers);
//header("Location:index.html");
?>
<script type='text/javascript'>
alert("Thank you for your details. We will respond to your enquiry promptly.");
window.location.href="Contact.html";
</script>
<?php
}
?>