I have created a contact form, please refer to the two codes linked below for the code I am using.
I would like to make this form prevent spam without adding a CAPTCHA, as many captcha codes often result in frustrated users.
I am looking for the best modification of my contact form code for spam prevention, the best will receive the cash reward. One way I'd like to see this achieved is by adding a hidden field which, if filled in by a spam bot, will prevent the form from being sent.
Hariprasad Vijayan answers:
Check the following url. It describes a method for avoiding spam.
Your code would be like this after implementing it
<form id="ff" method="post" action="<?php get_template_directory_uri(); ?>/wp-content/themes/Mag/scripts/insert.php">
<input type="text" placeholder="Please enter your name" name="name" id="name" required />
<input type="text" placeholder="Please enter your phone" name="phone" id="phone" />
<input type="text" placeholder="[email protected]" name="email" id="email" required />
<textarea rows="3" cols="1" placeholder="Message" name="message" id="message" required ></textarea>
<input id="this_title" type="text" name="this_title" value="" />
<input class="sendButton" type="submit" name="Submit" value="Send" />
$this_form_spam = $_POST['this_title'];
if ($this_form_spam == "")
// Get values from form
$to = "[email protected]";
$subject = "Potential Client Lead";
$message = " Name: " . $name . "\r\n Phone: " . $phone . "\r\n Email: " . $email . "\r\n Message: " . $message;
$from = "FirmFlip";
$headers = "From:" . $from . "\r\n";
$headers .= "Content-type: text/plain; charset=UTF-8" . "\r\n";
echo "Error! Please try again.";
// mock and laugh in the face of spam
Hope it helps you.
Sai kumar answers:
Are you using custom code for contact email. You can use some plugins to do this job. Contact form 7 is a good one with nice rating. Uou can configure it easily. I think your problem will solve with this plugin. Please check it and update me.
Arnav Joy answers:
check these two links
Just Me answers:
If you don't want to use any plugin you could add an extra value to the links on your page that lead to this contact form.
In the contactform add that value to a hidden field.
In the mail file check whether or not that hidden field value is present.
If it is not present someone accessed the contact form directly instead using a link on the website, which often means it is a bot.
It won't make it Fort Knoxx though.