I have a enrollment form where users have to input there address. I am using PHP for validation and currently I check to make sure the field is not empty. Here is my code:>
You need to consider regular expressions. I would start off using a split command: split(' ', $address)
.
From that point, you can add one extra else if
statement to test and see if the resultant string is empty.
BUT, more importantly, you will now have the tools to test the entire address string to see if it contains: a two letter state code followed by a comma, and a 5(or9) digit zip code.
(I can be more specific if you like.)