Drupal CCK form field - US states list

A Microservices Bestseller!
Building
Microservices

If you're ever creating a Drupal form using the CCK module and need to show a list of states (the United States) in a combo box (also known as a "select list" or "drop down" field), you'll want to have that list of states in the right format.

Fortunately (for you) I just ran into this problem, and created two different versions of CCK form state fields. This first one displays the full name of the state, and stores the two-digit state code in the database:

--|--
AL|ALABAMA
AK|ALASKA
AZ|ARIZONA
AR|ARKANSAS
CA|CALIFORNIA
CO|COLORADO
CT|CONNECTICUT
DE|DELAWARE
DC|DISTRICT OF COLUMBIA
FL|FLORIDA
GA|GEORGIA
HI|HAWAII
ID|IDAHO
IL|ILLINOIS
IN|INDIANA
IA|IOWA
KS|KANSAS
KY|KENTUCKY
LA|LOUISIANA
ME|MAINE
MD|MARYLAND
MA|MASSACHUSETTS
MI|MICHIGAN
MN|MINNESOTA
MS|MISSISSIPPI
MO|MISSOURI
MT|MONTANA
NE|NEBRASKA
NV|NEVADA
NH|NEW HAMPSHIRE
NJ|NEW JERSEY
NM|NEW MEXICO
NY|NEW YORK
NC|NORTH CAROLINA
ND|NORTH DAKOTA
OH|OHIO
OK|OKLAHOMA
OR|OREGON
PA|PENNSYLVANIA
RI|RHODE ISLAND
SC|SOUTH CAROLINA
SD|SOUTH DAKOTA
TN|TENNESSEE
TX|TEXAS
UT|UTAH
VT|VERMONT
VA|VIRGINIA
WA|WASHINGTON
WV|WEST VIRGINIA
WI|WISCONSIN
WY|WYOMING

As the documentation describes, the first field is the key, the second field is the displayed value, and the two fields are separated by the "|" symbol.

Two-digit US state codes for Drupal CCK forms

If you just want to show the states with their two-digit abbreviation codes, you don't need to supply both a key and a value, you can just use one column, like this:

--
AL
AK
AZ
AR
CA
CO
CT
DE
DC
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
A best-selling programming book on Amazon
The
Clean
Coder

Or, if you prefer to have both columns for some reason, here is the same data in the CCK form "select list" two-column format:

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

In summary, if you need a list of states in the United States for a CCK form field (combo box, dropdown, select list), I hope these lists of states are helpful.