View Full Version : Contact page with captcha

11-11-2011, 04:45 PM
I am working on this site: http://oneclickelectronics.com and I need a contact form integrated with recaptcha or some kind of simple captcha service that would prevent spam to my email. I have some knowledge of PHP but am unfamiliar with integrating a captcha service into a contact form. I am open to all suggestions. I am not sure what captcha services are out there to choose from. But I am looking for a simple free alternative. I do not want to use a premade contact form because I want to learn how to do this. Thank you to all who help :)

11-11-2011, 05:05 PM
This is one of the many free ones that is recommended by many.

Also you can easily create your own simple one, such as this

if (isset($_POST['submit')) {
$captcha = $_POST['code'];

if ($captcha != 20) {
//Error Captcha is wrong


What is 10 + 10?<br />
<input type="text" name="code" value=""><br />
<input type="submit" name="submit" value="Send Mail">

It's extremely simple and once bots learn the value it won't be good, but it's suggested that you have multiple ones and use the random function to auto change them per refresh or visit, that way it goes through like 5 different choices,

another idea would be to create a select box with like 20 options, and be like "What was the First President of the United States?" and have silly answers and the right one George Washington.

So there is many ways of doing it, such as craigslist new way of entering the right code, and then copying the text into another box to prove your human.

One more thing to mention if you have a max attempt of tries that would greatly help. Such as 3 or 5 tries and then you can't try again for like 15 minutes. It's annoying to some people, but it does help spam.

11-11-2011, 07:38 PM