I have a form on a client's website which requires the user to enter a valid postcode. Recently some users have been adding fake postcodes ("zz123 456" etc...). I need to add some validation to make sure that the postcode is a valid UK postcode.
Here a is a map showing UK postcodes: http://www.businesslistsuk.com/postcode_map.htm
How would I go about validating a postcode? Surely I cant test *every single* postcode against what was entered by the user. My thinking is to just check the first 2 characters of the postcode, however, some postcodes allows the second character to be a number and not a letter.
Im interested to here your comments. Thanks.