Please download the files here:http://wikisend.com/download/263948/postValidation.zip
Since I do not have access to your database or your connection parameters, you will have to make some minor changes.
Open up the checkZip.php file. You will see four definition lines at the top for the host, user, password, and database. You will want to change these to match your system settings. Currently, it is set up to use the username root, no password, and connect to a database called "zip". So make certain that you change these to your settings instead.
Once that is done, your postcode validation will work in real time.
In order to check a field against the database without submitting the field, you have to use AJAX. That is what this does. If you attempt to enter no postcode or a postcode that is too short or contains non-numeric data, you will immediately get the error message just like your other errors.
If you enter four numbers, an AJAX call will be made. An AJAX call queries the server for data. This checks the database to see if the postcode is in the valid_postcodes table. This can take a couple seconds. If it is not found in that table, the error message will display. If it is found, the focus will move to the next field.
Let me know if you have any questions. I'm here to help.
If you require assistance in the future, please feel free to request me directly by starting your questions with **For TheDoctor**.
Please remember to rate my answer. Thank you so much and have a wonderful day.