I'm trying to create some dialogs in my web-app that can auto-suggest possible Countries, States, Cities and Zips in a form.

I was planning on storing this information in a database, and making calls to it from AJAX as the user types.

I don't want anything overly complicated like the Geonames database that I was offered when I asked this question over at the GIS stackexchange.

I installed the Geonames database on my mysql server, but I found that it was more like points on the map (things like schools, stores etc) than it was just individual Countries, States, Cities and Zipcodes.

Please let me know if I am oversimplifying the problem, as it's entirely possible that I am.

I think we need more info from you about how you're planning on auto-populating these fields. Is it based on GeoIP info? Are you trying to calculate it based on a partial address? Are you using proximity to a known address/zip? Are you mapping a phone number/area code to city/zip? Or are you just autocompleting based on what the user types?
–
Lèse majestéDec 6 '11 at 7:29

1

I'd say using a proximity to a known address/zip. I want to group together locations (i.e. Country, State, City and Zip) that a user enters so they can be identified between multiple records as the same location.
–
leeand00Dec 6 '11 at 22:29

Note the important bit of the license agreement: All advertising materials and documentation mentioning features or use of this database must display the following acknowledgment: "This product includes data created by MaxMind, available from maxmind.com/&quot;
–
leeand00Dec 8 '11 at 7:26

It seems like you want a valid, accurate address from the user. Each country varies widely, but in the USA, the USPS maintains a current database of valid addresses, and everything you can possibly imagine about them. Vendors of proper address verification products (that can validate and standardize wrong/incomplete addresses) are CASS-Certified by the USPS.

There are a few options for doing what you want to do. The easiest of all, and most affordable (even free) is an address validation API. I work at a company called SmartyStreets which offers such an API called LiveAddress. There's a simple Javascript implementation you can just copy+paste into your website. As the user submits the form, they'll be prompted to choose a valid address based on what they typed. I am sure this will be of some use to you.

That would be a good thing to use to ensure the validity of the database, thank you for adding it. What I really want to be able to do is associate a record (an address) with a particular City, State, and Zip so that I can search for records associated with a particular City, State or Zip.
–
leeand00Jan 23 '12 at 5:11