Interacting with PHP for Server-side Data Validation with AJAX
(Page 1 of 4 )
Looking for new and creative ways to empower your AJAX-driven Web applications? Then you’ve landed at the right place. Welcome to the final part of the series “Server-side Data Validation with AJAX.” In three tutorials, this series demonstrates how to build a simple form checking system which uses AJAX to performing server-side validation on the data supplied by users.
Introduction
For those of you new to the topics discussed over the course of this series, let me put you quickly in the right context: my initial purpose was to build a quite simple form validation mechanism. It would combine the quick responsiveness of JavaScript for alerting users about what data is considered invalid, and the reliability of a server-side scripting language (in this case, PHP), in order to execute several input-checking routines.
Based on this schema, in the first article I constructed a sample online form that came in handy for implementing the basic structure of the validation system in question. Also, over the second tutorial, I went through the development of a group of JavaScript functions, focused on sending out HTTP requests via AJAX, in conjunction with controlling the proper flow of data validation.
The complete client-side source code of this AJAX application has been developed already. You also know each time a user enters data in a particular form field because this input is submitted to the server in the background. So the only programming block that remains to be built is the one related to executing server validation on the data itself.
In this concluding part, I'll write a PHP class that will be responsible for checking the validity of the data submitted with AJAX, in this way completing the entire application. Thus, let's waste no more time in preliminaries and see how the PHP class that I mentioned before will be properly coded.
Next: Validating data on the server: building an input checking PHP class >>
More Java Articles
More By Alejandro Gervasio