php/mysql append state to city

Posted by mike on Stack Overflow See other posts from Stack Overflow or by mike
Published on 2010-03-24T23:04:20Z Indexed on 2010/03/24 23:13 UTC
Read the original article Hit count: 188

Filed under:
|

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!

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql