BRINGING FORMS TO LIFE PHP Solution 5-7: Incorporating a reCAPTCHA widget into your form This PHP solution describes how to obtain a pair of software keys and add a reCAPTCHA widget to . Continue working with the same files as before. Alternatively, use and from the ch05 folder. 1. Go to , and click the Sign up Now! button. If you have a Gmail account, log in with your email address and password. If you don t have a Google account, you ll be prompted to create one. To create the software keys, enter your website s domain name, select. | BRINGING FORMS TO LIFE PHP Solution 5-7 Incorporating a reCAPTCHA widget into your form This PHP solution describes how to obtain a pair of software keys and add a reCAPTCHA widget to . Continue working with the same files as before. Alternatively use and from the ch05 folder. 1. Go to recaptcha whyrecaptcha and click the Sign up Now button. If you have a Gmail account log in with your email address and password. If you don t have a Google account you ll be prompted to create one. 2. To create the software keys enter your website s domain name select the check box if you want to enable them on all domains and click Create Key. The public and private keys are random strings of characters. Copy and save them in a text file on your local computer. 3. You also need recaptchalib. php which contains the PHP code to generate the reCAPTCHA widget. There s a copy in the includes folder. To get the most up-to-date version go to http apis recaptcha docs and click the link for the reCAPTCHA PHP library. 4. Include in . The file is needed both when the form first loads and when the mail processing script runs so the include command needs to come before the conditional statement that runs only if the form has been submitted . You also need to create variables for the public and private keys. Edit the code at the top of like this using your own public and private keys php include . includes require_once . includes public_key your_public_key private_key your_private_key errors array 5. The code that checks the user s response must be run only when the form has been submitted. If you plan to use a reCAPTCHA widget on every site you can put it in immediately after the code that validates the email address. However it will trigger an error if you decide not to use reCAPTCHA so I have put it in .