Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
i want display country n city witout using database or storing manully.plz help me?
Posted
Comments
Christian Graus 25-Aug-12 5:05am    
Given that you don't want to store these values anywhere, where do you hope they might come from ? They need to come from a manual list, or a data source. You need to explain why you want to do things in such a strange way, so we can understand what your thought process is, and what the issue is.
Member 9027346 25-Aug-12 5:11am    
actually i want to disply country n city in dropdown list.but there is more data of country n city so,i couldn't understood what to do.mns how to store it takes lots of time.
Christian Graus 25-Aug-12 5:13am    
You can find lists of data on the web to import. It doesn't take long and it's more reliable than black magic, which is your only other option to having a list to display from
Member 9027346 25-Aug-12 5:25am    
can we directly import country list from web without storing into the db?
Christian Graus 25-Aug-12 5:27am    
I am sorry, but this is just insane. You might find someone exposing a web service that provides country lists, but it still makes zero sense to have the country list your web site relies on, anywhere but inside your site.

Do you mean you want to get the location of the client? If this is the case, perhaps you could utilize IP Adress Locator[^]

It makes no sense to fetch the list of countries or cities from somewhere else. This would make your site unreliable. I'd suggest that you store the information in the database, file or whatever you feel appropriate.

If you don't want to create the information (if that's why you try to avoid storing them), why not create a small program which gets all the countries and cities from some web service etc and then using that program store them inside the db. This way you don't have to manually input the information and you can refresh the data every once in a while.
 
Share this answer
 
v2
Comments
Christian Graus 25-Aug-12 5:13am    
No. He means what he said, he wants to show a list of countries in drop downs, with states, but he doesn't want to type them in
Wendelius 25-Aug-12 6:07am    
Looks that way now after the OP has clarified the question.
Christian Graus 25-Aug-12 7:33am    
It's hard word getting from what people say, to what they need, sometimes
Wendelius 25-Aug-12 7:44am    
Sometimes :)
Espen Harlinn 25-Aug-12 8:44am    
5'ed!
You can alsways extract the data from http://countrycode.org/[^]

Getting a reliable list of cities for each country will require a bit of work though.

Perhaps CIA The World Factbook[^] can provide you with what you need.

Best regards
Espen Harlinn
 
Share this answer
 
v2
Comments
Wendelius 25-Aug-12 9:19am    
That was a surprising link but quite likely a reliable one :thumbsup:
Espen Harlinn 25-Aug-12 9:30am    
Thanks, it's one that's useful to know about :-D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900