Jump to content

Country/State auto fill


jnroche

Recommended Posts

Hi Guys!Is there a way I can get a code or something that already furnishes all the state for a given country say US or UK? this is for HTML/PHP coding...In my form I have this portion with fields to fill-out:...Country: (combobox here)State: (combobox here)...I can manually look up the list of states for each country(google, if applicable) and then hard code them to php or html... however it would be a tedious job going site to site just to find the list of states for a specific country.. what if all countries around the world have their own states!?Hope there is an answer to this... :)

Link to comment
Share on other sites

I've always wondered about this and zip codes too. Is there like a free access database for something like this?

Link to comment
Share on other sites

I keep mine in an include file but all database driven.

<option value="AL">Alabama (AL)</option><option value="AK">Alaska (AK)</option><option value="AB">Alberta (AB)</option><option value="AS">American Samoa (AS)</option><option value="AZ">Arizona (AZ)</option><option value="AR">Arkansas (AR)</option><option value="AP">Asia/Pacific (AP)</option><option value="AE">Atlantic/Europe/Africa (AE)</option><option value="BC">British Columbia (BC)</option><option value="CA">California (CA)</option><option value="AA">Carribean/Latin America (AA)</option><option value="CO">Colorado (CO)</option><option value="CT">Connecticut (CT)</option><option value="DE">Delaware (DE)</option><option value="DC">District of Columbia (DC)</option><option value="FM">Fed. St. Micronesia (FM)</option><option value="FL">Florida (FL)</option><option value="GA">Georgia (GA)</option><option value="GU">Guam (GU)</option><option value="HI">Hawaii (HI)</option><option value="ID">Idaho (ID)</option><option value="IL">Illinois (IL)</option><option value="IN">Indiana (IN)</option><option value="IA">Iowa (IA)</option><option value="KS">Kansas (KS)</option><option value="KY">Kentucky (KY)</option><option value="LB">Labrador (LB)</option><option value="LA">Louisiana (LA)</option><option value="ME">Maine (ME)</option><option value="MB">Manitoba (MB)</option><option value="MP">Mariana Islands (MP)</option><option value="MH">Marshall Islands (MH)</option><option value="MD">Maryland (MD)</option><option value="MA">Massachusetts (MA)</option><option value="MI">Michigan (MI)</option><option value="MN">Minnesota (MN)</option><option value="MS">Mississippi (MS)</option><option value="MO">Missouri (MO)</option><option value="MT">Montana (MT)</option><option value="NE">Nebraska (NE)</option><option value="NV">Nevada (NV)</option><option value="NB">New Brunswick (NB)</option><option value="NH">New Hampshire (NH)</option><option value="NJ">New Jersey (NJ)</option><option value="NM">New Mexico (NM)</option><option value="NY">New York (NY)</option><option value="NF">Newfoundland (NF)</option><option value="NC">North Carolina (NC)</option><option value="ND">North Dakota (ND)</option><option value="NT">Northwest Territories (NT)</option><option value="NS">Nova Scotia (NS)</option><option value="OH">Ohio (OH)</option><option value="OK">Oklahoma (OK)</option><option value="ON">Ontario (ON)</option><option value="OR">Oregon (OR)</option><option value="PA">Pennsylvania (PA)</option><option value="PE">Prince Edward Island (PE)</option><option value="PR">Puerto Rico (PR)</option><option value="QC">Quebec (QC)</option><option value="RI">Rhode Island (RI)</option><option value="PW">Saipan (PW)</option><option value="SK">Saskatchewan (SK)</option><option value="SC">South Carolina (SC)</option><option value="SD">South Dakota (SD)</option><option value="TN">Tennessee (TN)</option><option value="TX">Texas (TX)</option><option value="UT">Utah (UT)</option><option value="VT">Vermont (VT)</option><option value="VI">Virgin Islands (VI)</option><option value="VA">Virginia (VA)</option><option value="WA">Washington (WA)</option><option value="WV">West Virginia (WV)</option><option value="WI">Wisconsin (WI)</option><option value="WY">Wyoming (WY)</option><option value="YT">Yukon Territory (YT)</option>

Link to comment
Share on other sites

Zip codes are databased and they are subscription based - you pay $xxx a month to get updates.I do the countries the same way. I am not aware of a centralized database that keeps track for the countries or states in each country. In theory, they do not change as often.

Link to comment
Share on other sites

Yeah, I know of those companies that make you pay...I was just wondering if there was a free one.That's sad.

Link to comment
Share on other sites

USPS (United States Postal Service) has some online tools for checking address, zips ad that sort of thing online. You will have to look into it more though as I do not know much about it. You may have to pay a bit for it!

Link to comment
Share on other sites

  • 2 weeks later...
USPS (United States Postal Service) has some online tools for checking address, zips ad that sort of thing online. You will have to look into it more though as I do not know much about it. You may have to pay a bit for it!
thanks so much for all who posted. appreciate it so much. maybe the client can't do anything about it besides paying some services for this. glad client just resume without having to bother about the other states from other countries.thanks again.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...