DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

HTML Select List Of States In The US

  • submit to reddit
        I can never find one of these lists when I need it, so here it is!

<select name="State"> 
<option value="" selected="selected">Select a State</option> 
<option value="AL">Alabama</option> 
<option value="AK">Alaska</option> 
<option value="AZ">Arizona</option> 
<option value="AR">Arkansas</option> 
<option value="CA">California</option> 
<option value="CO">Colorado</option> 
<option value="CT">Connecticut</option> 
<option value="DE">Delaware</option> 
<option value="DC">District Of Columbia</option> 
<option value="FL">Florida</option> 
<option value="GA">Georgia</option> 
<option value="HI">Hawaii</option> 
<option value="ID">Idaho</option> 
<option value="IL">Illinois</option> 
<option value="IN">Indiana</option> 
<option value="IA">Iowa</option> 
<option value="KS">Kansas</option> 
<option value="KY">Kentucky</option> 
<option value="LA">Louisiana</option> 
<option value="ME">Maine</option> 
<option value="MD">Maryland</option> 
<option value="MA">Massachusetts</option> 
<option value="MI">Michigan</option> 
<option value="MN">Minnesota</option> 
<option value="MS">Mississippi</option> 
<option value="MO">Missouri</option> 
<option value="MT">Montana</option> 
<option value="NE">Nebraska</option> 
<option value="NV">Nevada</option> 
<option value="NH">New Hampshire</option> 
<option value="NJ">New Jersey</option> 
<option value="NM">New Mexico</option> 
<option value="NY">New York</option> 
<option value="NC">North Carolina</option> 
<option value="ND">North Dakota</option> 
<option value="OH">Ohio</option> 
<option value="OK">Oklahoma</option> 
<option value="OR">Oregon</option> 
<option value="PA">Pennsylvania</option> 
<option value="RI">Rhode Island</option> 
<option value="SC">South Carolina</option> 
<option value="SD">South Dakota</option> 
<option value="TN">Tennessee</option> 
<option value="TX">Texas</option> 
<option value="UT">Utah</option> 
<option value="VT">Vermont</option> 
<option value="VA">Virginia</option> 
<option value="WA">Washington</option> 
<option value="WV">West Virginia</option> 
<option value="WI">Wisconsin</option> 
<option value="WY">Wyoming</option>


Steven Benjamin replied on Sun, 2013/03/31 - 12:00pm

I appreciate it.

Snippets Manager replied on Wed, 2012/03/14 - 4:07am

Significantly excellent content, this kind of write-up is definitely captivating along with fascinating one.hp certification|| hp certificate|| hp certifications|| hp certification test|| hp certification exam|| ase certification|| ase study guides|| ase practice test|

Snippets Manager replied on Fri, 2009/07/31 - 8:27am

Your state list is great - but with just a couple of fairly simple adjustments it has become very very useful (and easy to use) in PHP. 1. Add <?=$ALstate;?> to each line, except change the AL to the state abbreviation (so, for Arizona, add <?=AZstate;?> between the value and the closing angle-bracket examples: >Alabama >Alaska (etc.) 2. Save in an include file (I used 'state.php') 3. In your code that includes state.php... a. After reading your database, assign the state to a variable b. Double-Assign the variable the value 'selected' c. include state.php example: Note that $my is an associative array containing the data from one record in a database (MySQL in this case) ?> $startstate=$my["M_STATE"].'state'; // add the .'state'; to help ensure the 2-character variable is unique $$startstate='selected'; // use the double-$ to create a variable with the name contained in the VALUE (e.g. AZstate) include('state.php'); // include the file and the state will be pre-selected by the state already in use ?>

Snippets Manager replied on Mon, 2009/07/20 - 3:12pm

Great help... Thanks a lot!!

Snippets Manager replied on Tue, 2009/04/07 - 7:16pm

Outstanding. It seems simple but this saves me sooooooooo much time.

Snippets Manager replied on Fri, 2008/12/05 - 8:17am

Great !! Thank you too.

Snippets Manager replied on Thu, 2008/09/25 - 2:39pm

and i am yet another person to register on this site just to post a thank you. Have a question though about the list. Technically, does DC count as a state??

Snippets Manager replied on Sat, 2008/08/02 - 6:19pm

Good job!!!

Snippets Manager replied on Mon, 2008/04/21 - 3:43pm


Snippets Manager replied on Fri, 2008/03/07 - 12:12pm

Thanks for this list! Appreciate it.

Snippets Manager replied on Sun, 2007/06/24 - 3:12pm

I registered just to say Thank you too. Thank you!

Snippets Manager replied on Thu, 2006/06/01 - 10:39pm

totally!!! thanks, dude!!!

Snippets Manager replied on Fri, 2006/03/10 - 7:39am

I registered just to say thanks for posting this - Much appreciated.