Help needed for avoiding spam on simple contact form

Hi folks,

I have a spam problem with my online form in

I keep receiving spam and what puzzles me is that the spam script does not need to fill the required fields to send the form.

I tried to add a math puzzle by inserting:

else if(document.contact_form.Filtro.value !== document.contact_form.Solucionfiltro.value) {
alert(“¡Por favor revise su respuesta!”);
return false; }


	<div class="formlabel">Demuestre que Vd. no es un espamer, escriba en letras el resultado de sumar tres y siete (en minúsculas):</div>
	<div class="formfield"><input type="text" name="Filtro" size="4" /></div>
	<input type=”hidden” name=”Solucionfiltro” value=”diez” >

However, the hidden field still shows on the browser (it doesn’t show the value but it shows an empty square) and I can’t get the form check to compare the values of “Filtro” and “Solucionfiltro”.

Any help would be appreciated.

Thx all.

Some spammers are using tricky techniques that are hard to diagnose, and really tough to properly combat.

You may want to consider instead using a tried and tested captcha solution, such as reCaptcha.

All that is needed to bypass your code is to turn off JavaScript. The spammers all do that as their first step.

You could indeed use Captcha as Paul suggested, another option would be using server side scripting, in your case PHP which you already use for your pages anyway

I wouldn’t recommend using javascript for your captcha because it won’t work in browsers with javascript turned off. Google took over reCaptcha some time ago and it’s one of the better free, easy to implement captchas. The only downside of reCaptcha is that it isn’t very flexible regarding styling, but depending on your skill level in php, you might consider building your own customised captcha.

Thx all,

Tried recaptcha, but I haven’t quite figured how to integrate it in the website.
Will work on it.


I use a pretty good contact form that seems to do a good job of blocking spam bots. You can find it at this link: