April 22, 201313 yr Hi all. I've been using a simple php script for my contact forms but keep getting a lot of junk mail. I've heard that you can use a hidden form field and get the PHP script to abort sending if the field is filled in by an automated spam bot. Please could someone help me implement this? I've looked at a few tutorials but they are too complicated for me as I'm not too good with PHP :/ Heres my form and script. Thanks a lot <form name="test" action="process.php" method="post"><input name="validate" type="hidden" /><input name="name" type="text" /><input name="email" type="text" /><textarea name="message" cols="" rows=""></textarea><input name="submit" type="submit" value="Submit"></form>---------------------<process.php>$emailSubject = 'Message From Website';$webMaster = 'xxx@xxx.com';$name = $_POST['name'];$email = $_POST['email'];$message = $_POST['message'];$body = <<<EODCustomer Name: $name <br><br>Email Address: $email <br><br>Message: $messageEOD;$headers = "From: $email\r\n";$headers .= "Content-type: text/html\r\n";$string=nl2br($string);$success = mail($webMaster, $emailSubject, $body, $headers);
April 22, 201313 yr Hi Drennan, There's been a discussion on this subject here: http://www.webdesignerforum.co.uk/topic/68584-anti-spam-form-without-captcha/?p=432632 The original poster has also provided a tutorial Lyndsey.
April 23, 201313 yr Author Thanks Lyndsey, that's just what I was looking for - something simple I may look into more advanced options if I still get spammed. Thanks guys
Create an account or sign in to comment