Problem
I want to provide users of my web with city selection when they are registering to this web app. I have to be sure, that the address is correct, because I am sending them regular mail consequently in order to verify their address. And nonsense or misspelled city names can cause trouble for me.
Current state
Up to now, I always used a database table with names of all cities in my country. My country has about 600 cities, so it wasn't problem to populate table manually from wikipedia. However, recently I am planning to allow registration from other countries including Germany and USA and that should be problem.
Question
I would like to ask you how city selection/validation could be solved professionally?
- Do I have to create a big table for all cities (with country foreign key) and populate it using some import scripts? Where should I look for data then? Have such import scripts already exist?
- Or is it better to use some third-side service to provide/validate city names. What would happen when this service went offline? Do you know such service? Could you give me example how to use it?
- Would you suggest completely different solution?