List of All US States HTML + Comma Separated

Written by:
Posted in:
Published: November 11, 2019

Comma Separated

Alabama, Alaska, Arizona, Arkansas, California, Colorado, Connecticut, Delaware, Florida, Georgia, Hawaii, Idaho, Illinois, Indiana, Iowa, Kansas, Kentucky, Louisiana, Maine, Maryland, Massachusetts, Michigan, Minnesota, Mississippi, Missouri, Montana, Nebraska, Nevada, New Hampshire, New Jersey, New Mexico, New York, North Carolina, North Dakota, Ohio, Oklahoma, Oregon, Pennsylvania, Rhode Island, South Carolina, South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, Washington, West Virginia, Wisconsin, Wyoming

HTML Select

<select name="state">
    <option value="alabama">Alabama</option>
    <option value="alaska">Alaska</option>
    <option value="arizona">Arizona</option>
    <option value="arkansas">Arkansas</option>
    <option value="california">California</option>
    <option value="colorado">Colorado</option>
    <option value="connecticut">Connecticut</option>
    <option value="delaware">Delaware</option>
    <option value="florida">Florida</option>
    <option value="georgia">Georgia</option>
    <option value="hawaii">Hawaii</option>
    <option value="idaho">Idaho</option>
    <option value="illinois">Illinois</option>
    <option value="indiana">Indiana</option>
    <option value="iowa">Iowa</option>
    <option value="kansas">Kansas</option>
    <option value="kentucky">Kentucky</option>
    <option value="louisiana">Louisiana</option>
    <option value="maine">Maine</option>
    <option value="maryland">Maryland</option>
    <option value="massachusetts">Massachusetts</option>
    <option value="michigan">Michigan</option>
    <option value="minnesota">Minnesota</option>
    <option value="mississippi">Mississippi</option>
    <option value="missouri">Missouri</option>
    <option value="montana">Montana</option>
    <option value="nebraska">Nebraska</option>
    <option value="nevada">Nevada</option>
    <option value="new-hampshire">New Hampshire</option>
    <option value="new-jersey">New Jersey</option>
    <option value="new-mexico">New Mexico</option>
    <option value="new-york">New York</option>
    <option value="north-carolina">North Carolina</option>
    <option value="north-dakota">North Dakota</option>
    <option value="ohio">Ohio</option>
    <option value="oklahoma">Oklahoma</option>
    <option value="oregon">Oregon</option>
    <option value="pennsylvania">Pennsylvania</option>
    <option value="rhode-island">Rhode Island</option>
    <option value="south-carolina">South Carolina</option>
    <option value="south-dakota">South Dakota</option>
    <option value="tennessee">Tennessee</option>
    <option value="texas">Texas</option>
    <option value="utah">Utah</option>
    <option value="vermont">Vermont</option>
    <option value="virginiae">Virginia</option>
    <option value="washington">Washington</option>
    <option value="west-virginia">West Virginia</option>
    <option value="wisconsin">Wisconsin</option>
    <option value="wyoming">Wyoming</option>
</select>

Abbreviations

Comma Separated

AL, AK, AZ, AR, CA, CO, CT, DE, FL, GA, HI, ID, IL, IN, IA, KS, KY, LA, ME, MD, MA, MI, MN, MS, MO, MT, NE, NV, NH, NJ, NM, NY, NC, ND, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VT, VA, WA, WV, WI, WY

Select List

<select name="state">
    <option value="al">AL</option>
    <option value="ak">AK</option>
    <option value="az">AZ</option>
    <option value="ar">AR</option>
    <option value="ca">CA</option>
    <option value="co">CO</option>
    <option value="ct">CT</option>
    <option value="de">DE</option>
    <option value="fl">FL</option>
    <option value="ga">GA</option>
    <option value="hi">HI</option>
    <option value="id">ID</option>
    <option value="il">IL</option>
    <option value="in">IN</option>
    <option value="ia">IA</option>
    <option value="ks">KS</option>
    <option value="ky">KY</option>
    <option value="la">LA</option>
    <option value="me">ME</option>
    <option value="md">MD</option>
    <option value="ma">MA</option>
    <option value="mi">MI</option>
    <option value="mn">MN</option>
    <option value="ms">MS</option>
    <option value="mo">MO</option>
    <option value="mt">MT</option>
    <option value="ne">NE</option>
    <option value="nv">NV</option>
    <option value="nh">NH</option>
    <option value="nj">NJ</option>
    <option value="nm">NM</option>
    <option value="ny">NY</option>
    <option value="nc">NC</option>
    <option value="nd">ND</option>
    <option value="oh">OH</option>
    <option value="ok">OK</option>
    <option value="or">OR</option>
    <option value="pa">PA</option>
    <option value="ri">RI</option>
    <option value="sc">SC</option>
    <option value="sd">SD</option>
    <option value="tn">TN</option>
    <option value="tx">TX</option>
    <option value="ut">UT</option>
    <option value="vt">VT</option>
    <option value="va">VA</option>
    <option value="wa">WA</option>
    <option value="wv">WV</option>
    <option value="wi">WI</option>
    <option value="wy">WY</option>
</select>

Bonus! Select List w/ Abbreviation as Value

<select name="state">
    <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="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>
</select>

Extra Bonus!

The code I used to make these lists:

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

$new_array = array();
foreach ($states as $key => $state) :
  $new_array[$abbreviations[$key]] = $state;
endforeach;

echo '<select name="state">';
foreach ($new_array as $key => $item) :
  echo '<option value="' . sanitize_title(strtolower($key)) . '">' . $item . '</option>';
endforeach;
echo '</select>';

foreach ($new_array as $key => $item) :
  echo $item;
  if(next($new_array)) {
    echo ', ';
  }
endforeach;
?>