Posted By

MikeNGarrett on 02/18/11


Tagged

states list array drupal United


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

beleneglorion


United States List, Array and Form Input


 / Published in: PHP
 

Different formats for listing states.

  1. // PHP Array:
  2. $state_list = array('AL'=>'Alabama',
  3. 'AK'=>'Alaska',
  4. 'AZ'=>'Arizona',
  5. 'AR'=>'Arkansas',
  6. 'CA'=>'California',
  7. 'CO'=>'Colorado',
  8. 'CT'=>'Connecticut',
  9. 'DE'=>'Delaware',
  10. 'DC'=>'District Of Columbia',
  11. 'FL'=>'Florida',
  12. 'GA'=>'Georgia',
  13. 'HI'=>'Hawaii',
  14. 'ID'=>'Idaho',
  15. 'IL'=>'Illinois',
  16. 'IN'=>'Indiana',
  17. 'IA'=>'Iowa',
  18. 'KS'=>'Kansas',
  19. 'KY'=>'Kentucky',
  20. 'LA'=>'Louisiana',
  21. 'ME'=>'Maine',
  22. 'MD'=>'Maryland',
  23. 'MA'=>'Massachusetts',
  24. 'MI'=>'Michigan',
  25. 'MN'=>'Minnesota',
  26. 'MS'=>'Mississippi',
  27. 'MO'=>'Missouri',
  28. 'MT'=>'Montana',
  29. 'NE'=>'Nebraska',
  30. 'NV'=>'Nevada',
  31. 'NH'=>'New Hampshire',
  32. 'NJ'=>'New Jersey',
  33. 'NM'=>'New Mexico',
  34. 'NY'=>'New York',
  35. 'NC'=>'North Carolina',
  36. 'ND'=>'North Dakota',
  37. 'OH'=>'Ohio',
  38. 'OK'=>'Oklahoma',
  39. 'OR'=>'Oregon',
  40. 'PA'=>'Pennsylvania',
  41. 'RI'=>'Rhode Island',
  42. 'SC'=>'South Carolina',
  43. 'SD'=>'South Dakota',
  44. 'TN'=>'Tennessee',
  45. 'TX'=>'Texas',
  46. 'UT'=>'Utah',
  47. 'VT'=>'Vermont',
  48. 'VA'=>'Virginia',
  49. 'WA'=>'Washington',
  50. 'WV'=>'West Virginia',
  51. 'WI'=>'Wisconsin',
  52. 'WY'=>'Wyoming');
  53.  
  54. // List of States
  55. /*
  56.  
  57. Alabama
  58. Alaska
  59. Arizona
  60. Arkansas
  61. California
  62. Colorado
  63. Connecticut
  64. Delaware
  65. District Of Columbia
  66. Florida
  67. Georgia
  68. Hawaii
  69. Idaho
  70. Illinois
  71. Indiana
  72. Iowa
  73. Kansas
  74. Kentucky
  75. Louisiana
  76. Maine
  77. Maryland
  78. Massachusetts
  79. Michigan
  80. Minnesota
  81. Mississippi
  82. Missouri
  83. Montana
  84. Nebraska
  85. Nevada
  86. New Hampshire
  87. New Jersey
  88. New Mexico
  89. New York
  90. North Carolina
  91. North Dakota
  92. Ohio
  93. Oklahoma
  94. Oregon
  95. Pennsylvania
  96. Rhode Island
  97. South Carolina
  98. South Dakota
  99. Tennessee
  100. Texas
  101. Utah
  102. Vermont
  103. Virginia
  104. Washington
  105. West Virginia
  106. Wisconsin
  107. Wyoming
  108. */
  109.  
  110. // Drupal Select field formatted
  111. /*
  112. AL|Alabama
  113. AK|Alaska
  114. AZ|Arizona
  115. AR|Arkansas
  116. CA|California
  117. CO|Colorado
  118. CT|Connecticut
  119. DE|Delaware
  120. DC|District Of Columbia
  121. FL|Florida
  122. GA|Georgia
  123. HI|Hawaii
  124. ID|Idaho
  125. IL|Illinois
  126. IN|Indiana
  127. IA|Iowa
  128. KS|Kansas
  129. KY|Kentucky
  130. LA|Louisiana
  131. ME|Maine
  132. MD|Maryland
  133. MA|Massachusetts
  134. MI|Michigan
  135. MN|Minnesota
  136. MS|Mississippi
  137. MO|Missouri
  138. MT|Montana
  139. NE|Nebraska
  140. NV|Nevada
  141. NH|New Hampshire
  142. NJ|New Jersey
  143. NM|New Mexico
  144. NY|New York
  145. NC|North Carolina
  146. ND|North Dakota
  147. OH|Ohio
  148. OK|Oklahoma
  149. OR|Oregon
  150. PA|Pennsylvania
  151. RI|Rhode Island
  152. SC|South Carolina
  153. SD|South Dakota
  154. TN|Tennessee
  155. TX|Texas
  156. UT|Utah
  157. VT|Vermont
  158. VA|Virginia
  159. WA|Washington
  160. WV|West Virginia
  161. WI|Wisconsin
  162. WY|Wyoming
  163. */
  164. // HTML form select list with abbreviations
  165. /*
  166. <select name="state" size="1">
  167. <option value="AK">AK</option>
  168. <option value="AL">AL</option>
  169. <option value="AR">AR</option>
  170. <option value="AZ">AZ</option>
  171. <option value="CA">CA</option>
  172. <option value="CO">CO</option>
  173. <option value="CT">CT</option>
  174. <option value="DC">DC</option>
  175. <option value="DE">DE</option>
  176. <option value="FL">FL</option>
  177. <option value="GA">GA</option>
  178. <option value="HI">HI</option>
  179. <option value="IA">IA</option>
  180. <option value="ID">ID</option>
  181. <option value="IL">IL</option>
  182. <option value="IN">IN</option>
  183. <option value="KS">KS</option>
  184. <option value="KY">KY</option>
  185. <option value="LA">LA</option>
  186. <option value="MA">MA</option>
  187. <option value="MD">MD</option>
  188. <option value="ME">ME</option>
  189. <option value="MI">MI</option>
  190. <option value="MN">MN</option>
  191. <option value="MO">MO</option>
  192. <option value="MS">MS</option>
  193. <option value="MT">MT</option>
  194. <option value="NC">NC</option>
  195. <option value="ND">ND</option>
  196. <option value="NE">NE</option>
  197. <option value="NH">NH</option>
  198. <option value="NJ">NJ</option>
  199. <option value="NM">NM</option>
  200. <option value="NV">NV</option>
  201. <option value="NY">NY</option>
  202. <option value="OH">OH</option>
  203. <option value="OK">OK</option>
  204. <option value="OR">OR</option>
  205. <option value="PA">PA</option>
  206. <option value="RI">RI</option>
  207. <option value="SC">SC</option>
  208. <option value="SD">SD</option>
  209. <option value="TN">TN</option>
  210. <option value="TX">TX</option>
  211. <option value="UT">UT</option>
  212. <option value="VA">VA</option>
  213. <option value="VT">VT</option>
  214. <option value="WA">WA</option>
  215. <option value="WI">WI</option>
  216. <option value="WV">WV</option>
  217. <option value="WY">WY</option>
  218. </select>
  219. */
  220. // HTML form select list with full names
  221. /*
  222. <select name="state" size="1">
  223. <option value="AL">Alabama</option>
  224. <option value="AK">Alaska</option>
  225. <option value="AZ">Arizona</option>
  226. <option value="AR">Arkansas</option>
  227. <option value="CA">California</option>
  228. <option value="CO">Colorado</option>
  229. <option value="CT">Connecticut</option>
  230. <option value="DE">Delaware</option>
  231. <option value="DC">Dist of Columbia</option>
  232. <option value="FL">Florida</option>
  233. <option value="GA">Georgia</option>
  234. <option value="HI">Hawaii</option>
  235. <option value="ID">Idaho</option>
  236. <option value="IL">Illinois</option>
  237. <option value="IN">Indiana</option>
  238. <option value="IA">Iowa</option>
  239. <option value="KS">Kansas</option>
  240. <option value="KY">Kentucky</option>
  241. <option value="LA">Louisiana</option>
  242. <option value="ME">Maine</option>
  243. <option value="MD">Maryland</option>
  244. <option value="MA">Massachusetts</option>
  245. <option value="MI">Michigan</option>
  246. <option value="MN">Minnesota</option>
  247. <option value="MS">Mississippi</option>
  248. <option value="MO">Missouri</option>
  249. <option value="MT">Montana</option>
  250. <option value="NE">Nebraska</option>
  251. <option value="NV">Nevada</option>
  252. <option value="NH">New Hampshire</option>
  253. <option value="NJ">New Jersey</option>
  254. <option value="NM">New Mexico</option>
  255. <option value="NY">New York</option>
  256. <option value="NC">North Carolina</option>
  257. <option value="ND">North Dakota</option>
  258. <option value="OH">Ohio</option>
  259. <option value="OK">Oklahoma</option>
  260. <option value="OR">Oregon</option>
  261. <option value="PA">Pennsylvania</option>
  262. <option value="RI">Rhode Island</option>
  263. <option value="SC">South Carolina</option>
  264. <option value="SD">South Dakota</option>
  265. <option value="TN">Tennessee</option>
  266. <option value="TX">Texas</option>
  267. <option value="UT">Utah</option>
  268. <option value="VT">Vermont</option>
  269. <option value="VA">Virginia</option>
  270. <option value="WA">Washington</option>
  271. <option value="WV">West Virginia</option>
  272. <option value="WI">Wisconsin</option>
  273. <option value="WY">Wyoming</option>
  274. </select>
  275. */

Report this snippet  

You need to login to post a comment.