I was under the assumption that a Zip Code is a subset of a city. IE: that a city may have multiple zip codes, but a zip code cannot belong to multiple cities.
Why do so many websites ask for a zip code. What are it's use outside a mail context?
Note: This is for the USA. Other countries may be different.
- A city may include multiple Zip Codes and a Zip Code may include multiple cities.
Multiple zip codes: New York, NY has a LOT of zip codes. Send mail to any of them with the city listed as New York, NY and it will get to the right place.
Multiple cities: 80241 lists preferred: Thornton, CO, acceptable: Denver, Northglenn, Westminster.
- Zip codes are for more than just mailing.
For example, zip codes are often used with a database of latitude/longitude in order to get a quick geographic location for finding nearest stores/service centers/etc.
- Cities are where you "want" to be. Zip codes are where you actually are. A classic example in my area is 20852. When I was little, that always meant "Rockville, MD". But that doesn't sound as swanky as "Bethesda, MD", so at some point they decided to give it an alternate name of "North Bethesda". I know it is all the same - and so does the USPS - but it makes some people feel better, so let them list what they want.
The ideal setup is to ask for zip code and use that as a lookup to find all valid cities and let the user select. But that requires a database and/or API, and is often not considered the effort/expense - in which case you ask for both Zip Code and City.