This can be done. Is it easy? Based on what you want to do, no... it's extremely difficult because your approach has 1 overwhelming flaw: cities commonly have more than 1 zip code. How are you going to know which zip code is correct for a given city? You'd need to base your zip code on the street address, plus city and state. This means a massive database with each street in a city, each city in a zip code, and each zip in a state.
The more common approach is to work backwards from zip code. The user enters the zip, and the form populates the city and state. This is much easier because a zip code can only exist in 1 city.