4

See the screenshot here:
http://media-cdn.pinterest.com/upload/185773553348981093_6T1oUT9E.jpg

I'd like the user to just type a city or country name and the autocompleter will show suggested items.

How should I start for creating it? Are there any API(s) or web services for me to call? Where can I find the database of all cities/countries in the world?

mmmmmm
  • 32,227
  • 27
  • 88
  • 117
Atthapon Junpun-eak
  • 540
  • 2
  • 11
  • 23

3 Answers3

4

I think this would be the best database for your situation, check it out:

http://www.geodatasource.com/cities-free.html

Alex
  • 5,971
  • 11
  • 42
  • 80
2

You first need a autocomplete plugin.
I recommend to use the jQuery-Ui Auto Complete Plugin.

The database could as example be this, but eventually try to search a bit for yourself.
There was already a question on stackoverflow about a database for cities of the world.
A simple text file with all cities may also be this.
There are very much of those libraries, but you have to chose the right one for you.

Community
  • 1
  • 1
evotopid
  • 5,288
  • 2
  • 26
  • 41
0

My solution may not be the best, but it's a starting point: Google a list with all countries (ISO-Standard), paste it into a txt-file. Then you can simply read that file with PHP an create a select menu with the contents of the file. It does not incorporate the cities, but maybe it helps you in some way.

Sven
  • 12,997
  • 27
  • 90
  • 148