Validating a form with php
The server side form validations help keeping the form submission data consistent.
The “validation descriptor” is a string specifying the type of validation to be performed.
For example, “req” means required, “alpha” means allow only alphabetic characters and so on.
What is the the most convenient way, the "best" way for validate a form with PHP? Because, more special characters can use the person when compile the password input during the registration, more secure is his account.
You could do it a little more elegant using OOP, but I think for the code you posted above the example should do.
Moreover, since you are doing the same or similar validation for most of the forms that you make, just too much of duplicate effort is spent on form validations.
Note: You can make web forms quickly with Simfatic Forms.
Client-side form validations help in giving immediate feedback to the user.
It is also required to add server side form validation in your form processing script.