Jump to content

Recommended Posts

how could i do something like this / is it possible

 

ok so a user picks what country the live in so uk our usa from drop down menu (allready know how to do this)

but then they enter there place name so london.. if no 1 has entred london then it gets inserted into uk.txt if uk.txt does not exsist then uk.txt is created

 

so next time someone goes to type in london under uk then london will spear as a selection

 

 

long bloated but first is it possibe and second how...or is there a better way to go about it

Link to comment
https://forums.phpfreaks.com/topic/107083-list-of-cities-picking-them-out/
Share on other sites

I would say a better way to go about it would just be to get a free database/text file somewhere of all the cities you can find and do it that way.  If you do not want to do that, I would just make the user write the name in.  There is no good reason to go about it in such a way as you would like.

 

What app are you using this for?  And will it only be the UK or the whole world?

Yes it is possible, and fairly easy to do.  Is there a better way? Depends on what this is for.  If you are wanting to go the route of "London" not existing until someone enters it in, you're going to have to deal with issues like people misspelling it (london, Lndn, londn, LongDong, etc..). 

 

Do you plan on being able to search for people by city?  Sending packages to people in the mail, or billing them? If not, then that's not really that big a deal.  But you did mention you wanted it to be added to your existing dropdown, so it is some kind of deal. 

 

Overall, I'd agree with phpknight's suggestion: go find a database/text file of cities/states/countries/etc...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.