After a previous tutorial on PHP Ajax web forms, there were a lot of good points raised by the readers which could dramatically improve the usability and performance of any PHP AJAX web form validation. Any good PHP web form should be able to accomplish the following important objectives: 1. The form validation should display all errors at once. The original web form discussed in the tutorial mentioned above can't currently display all errors found in the PHP server side validation. As a result, it will only display a single error at a time. This is due to the use of the die () command. For example: if ($countfirstname <2) { echo 'ERROR: You are using an invalid first name, it should contain more than one character.'; die (); }
The die () command terminates the execution of the PHP script and displays the error back to the browser. 2. The captcha needs to be difficult. Modern bots have evolved to read easy captchas, according to Wikipedia. Fulfilling a need for a more challenging captcha like Recaptcha ( ) is important. 3. Users should able to easily change wrong information entered into the form without needing to press the browser's back button. This is where 4. Combining a PHP web form with Main requirements Unfortunately this type of Recaptcha AJAX in PHP will not work in all hosting accounts. It requires: 1. That an important PHP function for communicating with Recaptcha server be enabled. An example of this function includes Fopen. Typically these are disabled in free hosting accounts for security reasons. However, if you have a paid hosting account, then you need to find out if these are enabled by checking php.ini file. 2. A Recaptcha account for your own website. You should register it by signing up for Recaptcha for free. You need two important keys which you will get after signing up, and it is recommended that you copy these keys to a text file like notepad for your personal records. These keys are the Public Key and the Private Key. Without these important keys, your PHP web form using
blog comments powered by Disqus |