PHP-MYSQL How to make a function that validates fields in a form?

any suggestions will be appreciated...

thanks

PedRo...