Skip to content

Instantly share code, notes, and snippets.

@MikSDigital
Created July 27, 2016 07:07
Show Gist options
  • Save MikSDigital/b3bbbff1ad0beb4d704631754c783d0a to your computer and use it in GitHub Desktop.
Save MikSDigital/b3bbbff1ad0beb4d704631754c783d0a to your computer and use it in GitHub Desktop.
<select class="" name="country" <?php echo setFieldStyle($errorFields, 'country') ?>>
<?php
// $current = $_SERVER['GEOIP_COUNTRY_CODE'];
//
// if ($_SERVER['GEOIP_COUNTRY_CODE'] == '') {
// $current = 'DEF';
// }
$current = 'DEF';
$country = array('Select Your Country *' => 'DEF', 'Argentina' => 'AR', 'Afghanistan' => 'AF', 'Albania' => 'AL', 'Algeria' => 'DZ', 'Andorra' => 'AD', 'Angola' => 'AO', 'Anguilla' => 'AI', 'Antigua and Barbuda' => 'AG', 'Armenia' => 'AM', 'Aruba' => 'AW', 'Australia' => 'AU', 'Austria' => 'AT', 'Azerbaijan' => 'AZ', 'Bahamas' => 'BS', 'Bahrain' => 'BH', 'Bangladesh' => 'BD', 'Barbados' => 'BB', 'Belarus' => 'BY', 'Belgium' => 'BE', 'Belize' => 'BZ', 'Bermuda' => 'BM', 'Bhutan' => 'BT', 'Bolivia' => 'BO', 'Bosnia and Herzegovina' => 'BA', 'Brazil' => 'BR', 'Brunei' => 'BN', 'Bulgaria' => 'BG', 'Cambodia' => 'KH', 'Cape Verde' => 'CV', 'Cayman Islands' => 'KY', 'Chile' => 'CL', 'China' => 'CN', 'Christmas Island' => 'CX', 'Cocos Islands' => 'CC', 'Colombia' => 'CO', 'Croatia' => 'HR', 'Cyprus' => 'CY', 'Czech Republic' => 'CZ', 'Denmark' => 'DK', 'Dominica' => 'DM', 'Dominican Republic' => 'DO', 'East Timor' => 'TL', 'Ecuador' => 'EC', 'Egypt' => 'EG', 'El Salvador' => 'SV', 'Estonia' => 'EE', 'Falkland Islands' => 'FK', 'Faroe Islands' => 'FO', 'Fiji' => 'FJ', 'Finland' => 'FI', 'France' => 'FR', 'French Guiana' => 'GF', 'French Polynesia' => 'PF', 'Georgia' => 'GE', 'Germany' => 'DE', 'Ghana' => 'GH', 'Gibraltar' => 'GI', 'Greece' => 'GR', 'Greenland' => 'GL', 'Grenada' => 'GD', 'Guatemala' => 'GT', 'Guyana' => 'GY', 'Haiti' => 'HT', 'Honduras' => 'HN', 'Hungary' => 'HU', 'Iceland' => 'IS', 'India' => 'IN', 'Indonesia' => 'ID', 'Iraq' => 'IQ', 'Ireland' => 'IE', 'Isle of Man' => 'IM', 'Israel' => 'IL', 'Italy' => 'IT', 'Jamaica' => 'JM', 'Jordan ' => 'JO', 'Kazakhstan' => 'KZ', 'Kuwait' => 'KW', 'Kyrgyzstan' => 'KG', 'Laos' => 'LA', 'Latvia' => 'LV', 'Lebanon ' => 'LB', 'Liechtenstein' => 'LI', 'Lithuania' => 'LT', 'Luxembourg' => 'LU', 'Macedonia' => 'MK', 'Malaysia' => 'MY', 'Maldives' => 'MV', 'Malta' => 'MT', 'Mauritius' => 'MU', 'Mexico' => 'MX', 'Moldova' => 'MD', 'Monaco' => 'MC', 'Mongolia' => 'MN', 'Montenegro' => 'ME', 'Morocco' => 'MA', 'Nepal' => 'NP', 'Netherlands' => 'NL', 'New Zealand' => 'NZ', 'Nicaragua' => 'NI', 'Nigeria' => 'NG', 'Norway' => 'NO', 'Oman' => 'OM', 'Pakistan' => 'PK', 'Palestine' => 'PS', 'Panama' => 'PA', 'Papua New Guinea' => 'PG', 'Paraguay' => 'PY', 'Peru' => 'PE', 'Philippines' => 'PH', 'Poland' => 'PL', 'Portugal' => 'PT', 'Puerto Rico' => 'PR', 'Qatar' => 'QA', 'Reunion' => 'RE', 'Romania' => 'RO', 'Russia' => 'RU', 'Saint Barthélemy' => 'BL', 'Saint Kitts and Nevis' => 'KN', 'Saint Lucia' => 'LC', 'Saint Martin' => 'MF', 'Saint Vincent and the Grenadines' => 'VC', 'Samoa' => 'WS', 'San Marino' => 'SM', 'Saudi Arabia' => 'SA', 'Serbia' => 'RS', 'Seychelles' => 'SC', 'Singapore' => 'SG', 'Slovakia' => 'SK', 'Slovenia' => 'SI', 'Solomon Islands' => 'SB', 'South Africa' => 'ZA', 'South Korea' => 'KR', 'Spain' => 'ES', 'Sri Lanka' => 'LK', 'Suriname' => 'SR', 'Sweden' => 'SE', 'Switzerland' => 'CH', 'Taiwan' => 'TW', 'Tajikistan' => 'TJ', 'Thailand' => 'TH', 'Timor-Lest' => 'TL', 'Tokelau' => 'TK', 'Tonga' => 'TO', 'Trinidad and Tobago' => 'TT', 'Tunisia' => 'TN', 'Turkey' => 'TR', 'Turkmenistan' => 'TM', 'Turks and Caicos Islands' => 'TC', 'Tuvalu' => 'TV', 'Ukraine' => 'UA', 'United Arab Emirates' => 'AE', 'United Kingdom' => 'GB', 'Uruguay' => 'UY', 'Uzbekistan' => 'UZ', 'Vanuatu' => 'VU', 'Vatican City' => 'VA', 'Venezuela' => 'VE', 'Vietnam' => 'VN', 'Virgin Islands, British' => 'VG');
foreach ($country as $country => $item) {
echo "<option value='" . $item . "'";
if ($item == $current) {
echo 'selected>' . $country . '</option>';
} else {
echo ">" . $country . "</option>";
}
} ?>
</select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment