Country list drop down in Codeigniter


/ Published in: PHP
Save to your folder(s)

This is a list of county name which is generated in php and how to echo it in Codeigniter way. Hope this help!


Copy this code and paste it in your HTML
  1. <?php
  2. $country = array(
  3. "-1" => "Select Country",
  4. "AF" => "Afghanistan",
  5. "AL" => "Albania",
  6. "DZ" => "Algeria",
  7. "AS" => "American Samoa",
  8. "AD" => "Andorra",
  9. "AO" => "Angola",
  10. "AI" => "Anguilla",
  11. "AQ" => "Antarctica",
  12. "AG" => "Antigua and Barbuda",
  13. "AR" => "Argentina",
  14. "AM" => "Armenia",
  15. "AW" => "Aruba",
  16. "AU" => "Australia",
  17. "AT" => "Austria",
  18. "AZ" => "Azerbaijan",
  19. "BS" => "Bahamas",
  20. "BH" => "Bahrain",
  21. "BD" => "Bangladesh",
  22. "BB" => "Barbados",
  23. "BY" => "Belarus",
  24. "BE" => "Belgium",
  25. "BZ" => "Belize",
  26. "BJ" => "Benin",
  27. "BM" => "Bermuda",
  28. "BT" => "Bhutan",
  29. "BO" => "Bolivia",
  30. "BA" => "Bosnia and Herzegowina",
  31. "BW" => "Botswana",
  32. "BV" => "Bouvet Island",
  33. "BR" => "Brazil",
  34. "IO" => "British Indian Ocean Territory",
  35. "BN" => "Brunei Darussalam",
  36. "BG" => "Bulgaria",
  37. "BF" => "Burkina Faso",
  38. "BI" => "Burundi",
  39. "KH" => "Cambodia",
  40. "CM" => "Cameroon",
  41. "CA" => "Canada",
  42. "CV" => "Cape Verde",
  43. "KY" => "Cayman Islands",
  44. "CF" => "Central African Republic",
  45. "TD" => "Chad",
  46. "CL" => "Chile",
  47. "CN" => "China",
  48. "CX" => "Christmas Island",
  49. "CC" => "Cocos (Keeling) Islands",
  50. "CO" => "Colombia",
  51. "KM" => "Comoros",
  52. "CG" => "Congo",
  53. "CK" => "Cook Islands",
  54. "CR" => "Costa Rica",
  55. "CI" => "Cote D'Ivoire",
  56. "HR" => "Croatia",
  57. "CU" => "Cuba",
  58. "CY" => "Cyprus",
  59. "CZ" => "Czech Republic",
  60. "DK" => "Denmark",
  61. "DJ" => "Djibouti",
  62. "DM" => "Dominica",
  63. "DO" => "Dominican Republic",
  64. "TL" => "East Timor",
  65. "EC" => "Ecuador",
  66. "EG" => "Egypt",
  67. "SV" => "El Salvador",
  68. "GQ" => "Equatorial Guinea",
  69. "ER" => "Eritrea",
  70. "EE" => "Estonia",
  71. "ET" => "Ethiopia",
  72. "FK" => "Falkland Islands (Malvinas)",
  73. "FO" => "Faroe Islands",
  74. "FJ" => "Fiji",
  75. "FI" => "Finland",
  76. "FR" => "France",
  77. "FX" => "France, Metropolitan",
  78. "GF" => "French Guiana",
  79. "PF" => "French Polynesia",
  80. "TF" => "French Southern Territories",
  81. "GA" => "Gabon",
  82. "GM" => "Gambia",
  83. "GE" => "Georgia",
  84. "DE" => "Germany",
  85. "GH" => "Ghana",
  86. "GI" => "Gibraltar",
  87. "GR" => "Greece",
  88. "GL" => "Greenland",
  89. "GD" => "Grenada",
  90. "GP" => "Guadeloupe",
  91. "GU" => "Guam",
  92. "GT" => "Guatemala",
  93. "GN" => "Guinea",
  94. "GW" => "Guinea-bissau",
  95. "GY" => "Guyana",
  96. "HT" => "Haiti",
  97. "HM" => "Heard and Mc Donald Islands",
  98. "HN" => "Honduras",
  99. "HK" => "Hong Kong",
  100. "HU" => "Hungary",
  101. "IS" => "Iceland",
  102. "IN" => "India",
  103. "ID" => "Indonesia",
  104. "IR" => "Iran (Islamic Republic of)",
  105. "IQ" => "Iraq",
  106. "IE" => "Ireland",
  107. "IL" => "Israel",
  108. "IT" => "Italy",
  109. "JM" => "Jamaica",
  110. "JP" => "Japan",
  111. "JO" => "Jordan",
  112. "KZ" => "Kazakhstan",
  113. "KE" => "Kenya",
  114. "KI" => "Kiribati",
  115. "KP" => "Korea, Democratic People's Republic of",
  116. "KR" => "Korea, Republic of",
  117. "KW" => "Kuwait",
  118. "KG" => "Kyrgyzstan",
  119. "LA" => "Lao People's Democratic Republic",
  120. "LV" => "Latvia",
  121. "LB" => "Lebanon",
  122. "LS" => "Lesotho",
  123. "LR" => "Liberia",
  124. "LY" => "Libyan Arab Jamahiriya",
  125. "LI" => "Liechtenstein",
  126. "LT" => "Lithuania",
  127. "LU" => "Luxembourg",
  128. "MO" => "Macau",
  129. "MK" => "Macedonia, The Former Yugoslav Republic of",
  130. "MG" => "Madagascar",
  131. "MW" => "Malawi",
  132. "MY" => "Malaysia",
  133. "MV" => "Maldives",
  134. "ML" => "Mali",
  135. "MT" => "Malta",
  136. "MH" => "Marshall Islands",
  137. "MQ" => "Martinique",
  138. "MR" => "Mauritania",
  139. "MU" => "Mauritius",
  140. "YT" => "Mayotte",
  141. "MX" => "Mexico",
  142. "FM" => "Micronesia, Federated States of",
  143. "MD" => "Moldova, Republic of",
  144. "MC" => "Monaco",
  145. "MN" => "Mongolia",
  146. "MS" => "Montserrat",
  147. "MA" => "Morocco",
  148. "MZ" => "Mozambique",
  149. "MM" => "Myanmar",
  150. "NA" => "Namibia",
  151. "NR" => "Nauru",
  152. "NP" => "Nepal",
  153. "NL" => "Netherlands",
  154. "AN" => "Netherlands Antilles",
  155. "NC" => "New Caledonia",
  156. "NZ" => "New Zealand",
  157. "NI" => "Nicaragua",
  158. "NE" => "Niger",
  159. "NG" => "Nigeria",
  160. "NU" => "Niue",
  161. "NF" => "Norfolk Island",
  162. "MP" => "Northern Mariana Islands",
  163. "NO" => "Norway",
  164. "OM" => "Oman",
  165. "PK" => "Pakistan",
  166. "PW" => "Palau",
  167. "PA" => "Panama",
  168. "PG" => "Papua New Guinea",
  169. "PY" => "Paraguay",
  170. "PE" => "Peru",
  171. "PH" => "Philippines",
  172. "PN" => "Pitcairn",
  173. "PL" => "Poland",
  174. "PT" => "Portugal",
  175. "PR" => "Puerto Rico",
  176. "QA" => "Qatar",
  177. "RE" => "Reunion",
  178. "RO" => "Romania",
  179. "RU" => "Russian Federation",
  180. "RW" => "Rwanda",
  181. "KN" => "Saint Kitts and Nevis",
  182. "LC" => "Saint Lucia",
  183. "VC" => "Saint Vincent and the Grenadines",
  184. "WS" => "Samoa",
  185. "SM" => "San Marino",
  186. "ST" => "Sao Tome and Principe",
  187. "SA" => "Saudi Arabia",
  188. "SN" => "Senegal",
  189. "SC" => "Seychelles",
  190. "SL" => "Sierra Leone",
  191. "SG" => "Singapore",
  192. "SK" => "Slovakia (Slovak Republic)",
  193. "SI" => "Slovenia",
  194. "SB" => "Solomon Islands",
  195. "SO" => "Somalia",
  196. "ZA" => "South Africa",
  197. "GS" => "South Georgia and the South Sandwich Islands",
  198. "ES" => "Spain",
  199. "LK" => "Sri Lanka",
  200. "SH" => "St. Helena",
  201. "PM" => "St. Pierre and Miquelon",
  202. "SD" => "Sudan",
  203. "SR" => "Suriname",
  204. "SJ" => "Svalbard and Jan Mayen Islands",
  205. "SZ" => "Swaziland",
  206. "SE" => "Sweden",
  207. "CH" => "Switzerland",
  208. "SY" => "Syrian Arab Republic",
  209. "TW" => "Taiwan",
  210. "TJ" => "Tajikistan",
  211. "TZ" => "Tanzania, United Republic of",
  212. "TH" => "Thailand",
  213. "TG" => "Togo",
  214. "TK" => "Tokelau",
  215. "TO" => "Tonga",
  216. "TT" => "Trinidad and Tobago",
  217. "TN" => "Tunisia",
  218. "TR" => "Turkey",
  219. "TM" => "Turkmenistan",
  220. "TC" => "Turks and Caicos Islands",
  221. "TV" => "Tuvalu",
  222. "UG" => "Uganda",
  223. "UA" => "Ukraine",
  224. "AE" => "United Arab Emirates",
  225. "GB" => "United Kingdom",
  226. "US" => "United States",
  227. "UM" => "United States Minor Outlying Islands",
  228. "UY" => "Uruguay",
  229. "UZ" => "Uzbekistan",
  230. "VU" => "Vanuatu",
  231. "VA" => "Vatican City State (Holy See)",
  232. "VE" => "Venezuela",
  233. "VN" => "Viet Nam",
  234. "VG" => "Virgin Islands (British)",
  235. "VI" => "Virgin Islands (U.S.)",
  236. "WF" => "Wallis and Futuna Islands",
  237. "EH" => "Western Sahara",
  238. "YE" => "Yemen",
  239. "RS" => "Serbia",
  240. "CD" => "The Democratic Republic of Congo",
  241. "ZM" => "Zambia",
  242. "ZW" => "Zimbabwe",
  243. "JE" => "Jersey",
  244. "BL" => "St. Barthelemy",
  245. "XU" => "St. Eustatius",
  246. "XC" => "Canary Islands",
  247. "ME" => "Montenegro"
  248. );
  249.  
  250. echo form_dropdown('reg_country', $country, '-1');
  251.  
  252. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.