Validating birthdate to be greater than 18 years
I'm not going to show that here, but you can find a link to get started under References below.
When capturing information for insertion into a database, or use in other processing, it's important to control what the user can enter.
Otherwise you can end up with values in the database that have no relation to reality.
The code behind the form now is as follows: If you're not already familiar with regular expressions, then this might be getting a bit complicated.
Basically, for each of the regular expression tests, an array is returned holding each component of the pattern that we've matched.