php/mysql append state to city
- by mike
Hello,
Having a hard time figuring out the best way to do this...
I have a search function that takes "search terms" and "search location". In the location input, I have an suggestion feature that brings up "city, state abbreviation" but it seems some users just do not use it(or can't) so they end up entering just a city name... I need to append the state abbreviation after the form is submitted. I have a table with all city and state names in the U.S. but the problem is... there are multiple cities with the same name in different states... I would like to add the state abbreviation for the state that the city is most popular for(does that make sense?).
For example, if the user enters "Miami" I would like it to become "Miami, FL" as opposed to "Miami, WV"...
Any ideas?
Thanks!