PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
The PHP Validation script is a set of validation rules which lets you add server-side validation to your forms quickly and with as little effort as possible.
We’ll go into more detail in the later pages – this page is mainly just to give you a general sense of how it fits together.
1. Download and upload the PHP validation script (validation.php) to your web server and include() or require() that file via PHP in your form page. Note: your form will need to be a .php page.
2. Direct your form to submit its contents to itself using the action=”” attribute. When the form successfully passes your validation rules, you can redirect via PHP to whatever page you want the user to see next. If it fails, you can output the errors directly in the form page for the user to fix.
3. Add your form-specific validation rules to the top of your form page before the opening tag. These validation rules are basically a LIST (or an array for the technically-literate), saying which form fields need to validated, in what way, and what errors should be displayed to the user if they’re not filled in properly.
4. Add some display code into your page which will output any errors that occur.