I wrote this script a long time ago to validate a form with required fields before it was sent.
As a nice feature it can validate from one label to multiple inputs and is capable of RegEx.
Some user might have a problem to recognize which input field has an error.
This .error class adds a pulsing border in a nice red color.
api.js & api.php
I wrote a web application with many interactive JavaScript actions to dynamically change the content.
After a few sites I was tired of writing almost the same requests. Therefore I wrote an API interface to speed up my implementations.
While writing a PHP based website, you'll need the base directory and the base url quite often.
First thing to load is base.php and BASEDIR, BASEURL and REMOTEIP are available on all sites.