Adding CAPTCHAs to your POST form

Overview

Spam is something that every web developer and website owner has to contend with at one time or other. One of the more common solutions for fighting spam is to include a "CAPTCHA" in your form. CAPTCHA is an acronym for Completely Automated Public Turing test to tell Computers and Humans Apart. It involves displaying an image that cannot be interpreted by automated spam scripts, helping prevent dud form submissions.

You can add submissions to Form Tools by three methods: using a Form Builder page, using the API or by directly posting your form to the process.php script. The third type is known as a POST form; this tutorial explains how to add a CAPTCHA to that form type. For more information on the types, click here.

Meet reCAPTCHA

The Form Tools API comes pre-configured with a very powerful CAPTCHA service: reCAPTCHA. reCAPTCHA is a free service that helps to digitize books, newspapers and old time radio shows. Unlike other CAPTCHAs, all that time that's spent by countless people on countless websites filling in those little characters actually goes towards something useful. Plus, unlike other CAPTCHA scripts / services, reCAPTCHAs are attractive and readable - which can help cut down on unnecessary frustration for your site visitors.

You can learn more about reCAPTCHA on their website.

Warning / Disclaimer

The truth is, POSTing form content to Form Tools doesn't allow for much else than submitting the form content. The data is sent to process.php where it converts the data into database queries and redirects the user to the "thankyou" page. Things like adding server-side validation or CAPTCHAs is something very much outside of the original scope, and as such, the following tutorial is really something of a "hack". The whole idea of POST forms was for simple integration of simple forms - something that anyone could do. For power-users, there's the API. This tutorial and solution was devised because adding CAPTCHAs to POST forms is very much needed to combat spam. But ideally, you might want to consider learning how to use the API to submit your forms. Check out this tutorial if you're interested...!

Warning / disclaimer over!

Limitations

This only works for forms that are found on the same website as your Form Tools installation.

Edit Page