Hi Everyone
I am trying to cobble together a contact form with a Honey Pot Spam protector. Newby here. I’m basing it off of the following link but I am trying to tweak it so that it will do what I want it to do.
http://devgrow.com/simple-php-honey-pot/
You can see the contact form here http://www.discovermassagespa.com/contact.html.
Please do not look at the php code for http://www.discovermassagespa.com/contactus.php as I am changing that. Please refer to the following code.
<?php
/* Email Variables */
$emailSubject = 'The Massage Spa';
$webMaster = 'matt@webskillsplus.com';
//$webMaster = 'info@discovermassagespa.com';
//$webMaster = 'murrterr@rcn.com';
/* Data Variables */
$Name = $_POST['Name'];
$LastName = $_POST['LastName'];
$Email = $_POST['Email'];
$Area_Code = $_POST['Area_Code'];
$Phone_Prefix = $_POST['Phone_Prefix'];
$Line_Number = $_POST['Line_Number'];
$help = $_POST['help'];
if (isset($_POST["submit"])) {
echo $_POST["when"];
$robotest = <<<EOD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<p>This site is spam protected. If you are human please go back and try again.</p>
<p>The Massage Spa Team.</p>
</body>
</html>
EOD;
echo "$robotest";
} else {
$body = <<<EOD
\\r\
\\r\
<br>
First Name: $Name \\r\
<br>
Last Name: $LastName \\r\
<br>
Email: $Email \\r\
<br>
Phone: $Area_Code $Phone_Prefix $Line_Number \\r\
<br>
How can we help you?: $help \\r\
<br>
When: $when \\r\
<br>
EOD;
$from = "From: info@discovermassagespa.com\\r\
";
$from .= "Reply-To: ".$Email."\\r\
";
$from .= "Content-type: text/html\\r\
";
mail($webMaster, $emailSubject, $body, $from);
/* Prepare autoresponder subject */
$respond_subject = "Thank you for contacting Massage Spa";
/* Prepare autoresponder message */
$respond_message = "Thank you for contacting Massage Spa
Someone will contact you soon.
15966 Hickman Road, Clive Iowa 50325
515.987.4593
info@discovermassagespa.com
Shop Hours: Mon-Fri 10am-9pm, Sa 9am-7pm, Su 11am-4pm
";
$from = "From: info@discovermassagespa.com\\r\
";
/* Send the message using mail() function */
mail($Email, $respond_subject, $respond_message, $from);
/* Results rendered as HTML */
$theResults = <<<EOD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<p>Thanks for contacting us.</p>
<p>The Massage Spa Team.</p>
</body>
</html>
EOD;
echo "$theResults";
}
?>
The following is the HTML and the CSS that is relevant to the Honey Pot.
<p class="robotic" id="pot">
<label>If you're human leave this blank:</label>
<input name="robotest" type="text" id="robotest" class="robotest" /></p>
.robotic {
display: none;
}
I’m not sure what I am doing wrong. Thanks in advance for your help.