HomePHP Building a PHP 5 Form Processor: Using the Form Processor Package
Building a PHP 5 Form Processor: Using the Form Processor Package
Welcome to the last part of the series “Building a PHP 5 form processor.” In three parts, this series goes through the development of an extensible form processor package in PHP 5, explaining its benefits and demonstrating its implementation.
Returning for a moment to the previous article, I put my effort into writing a reusable class, which originally exposed a set of predefined methods, useful for performing server-side validation on user-supplied data.
If you’ve been reading the earlier tutorials, then you know that the goal of this series was developing a PHP form processing package, comprised of two highly generic components. The first component is a form generator module, which presents a bunch of classes for programmatically constructing online forms, offering optional basic client-side validation capabilities. The second one is a form validation module that exposes a series of methods for validating user-provided data. Together, both components can be implemented as a standalone package within a PHP application, in order to build and quickly process web forms.
Now, before proceeding further, let’s spend a few minutes discussing the objectives of this last tutorial, so you can have an accurate idea of how I’ll use this form processing library. Basically, I’ll set up an example, in order to demonstrate the functionality of both modules within a real application. First, I’ll use the corresponding classes for constructing an online form, then I’ll instruct the application to apply client-side validation on some of the form fields. Finally I'll have the application perform server-side checking on the form data, by displaying the appropriate error messages if any values entered on the form eventually fail to pass the verification process.
So, that’s the theory. Let’s now turn our attention to writing the hands-on example. You’ll have a really good time. Let’s go!