This is an example about how to use this simple form validation function. Check also the link in the header for the PHP and for further explanation.

I used a different styles 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

DigitalOceanSSD Cloud Server from $5/month by DigitalOcean, simple cloud hosting, built for developers. Receive $10 in credits »
ServerPilotServerPilot is the best way to run WordPress and PHP sites on your DigitalOcean servers. First month free »