Demos » Simple form field validation, demonstration
This is an example about how to use this function. Check also the code on the snippet page for further explanation.
I used a different style for form fields from the type text if they are empty (notice the yellow background color for the text fields).
Test this form
Required fields: name, your time, some field, checkbox
Related PHP functions:
array_key_exists | explode | in_array | count | ltrim
Click here for the PHP validation script.