r/HTML•
switchbackk

[OWN] Need a bit of help adding a CAPTCHA to existing form

Solved

Hi guys, new here so please be gentle.

I am attempting to add a captcha to an existing web-form. The site is just an info page for my fathers company but since setting up the contact he has had a few spam mails, so we're attempting to add this security feature.

The relevant part of my page with the form I have copied the code to here: http://jsfiddle.net/ptSB8/

It uses a mail.php to send the form, it can be found here: http://jsfiddle.net/2JPz9/

I assume some code has to be added to both, or a whole new approach needed to seek the validation of a correct captcha input.

Any kind of captcha would do fine. Let me know if I have to give any more information. Your help is most definitely appreciated.

The web address is http://www.premiumhomes.co.uk

Posted Jun 11, 2014, 2:07 PM UTC

21
Nekos•

Hi there! I can see the CAPTCHA on the form, but you'll need to add something that validates the CAPTCHA code on the php side as well. I'm assuming you're not super familiar with PHP, so my suggestion here is to use something like reCAPTCHA offered by Google. Here is the PHP specific guide for adding reCAPTCHA and validation.

Follow the steps outlined, and when you get to editing verify.php, the line where it says

// Your code here to handle a successful verification

You should be able to just copy and paste the php code there from your jsfidde - minus the <?php and ?> at the beginning and end, of course.

Hope that helps! Good luck. :)

1