Uno script che permette di trovare il nome di uno stato a partire dalla sua sigla.
<input type="text" size="2" maxlength="2" name="code">
<b>«</b> Enter two letter country code
<br>
<br>
<input type="submit" value="Lookup Code">
<br>
<br>
<input type="text" size="25" value="<?
if (isset($code)) // checks for variable to avoid error on load
{
$code = strtoupper($code); // converts to uppercase
switch ($code)
{
case "AC": print "Ascension Island"; break;
case "AD": print "Andorra"; break;
case "AE": print "United Arab Emirates"; break;
case "AF": print "Afghanistan"; break;
case "AG": print "Antigua and Barbuda"; break;
case "AI": print "Anguilla"; break;
case "AL": print "Albania"; break;
case "AM": print "Armenia"; break;
case "AN": print "Netherlands Antilles"; break;
case "AO": print "Angola"; break;
case "AQ": print "Antarctica"; break;
case "AR": print "Argentina"; break;
case "AS": print "American Samoa"; break;
case "AT": print "Austria"; break;
case "AU": print "Australia"; break;
case "AW": print "Aruba"; break;
case "AZ": print "Azerbaijan"; break;
case "BA": print "Bosnia and Herzegovina"; break;
case "BB": print "Barbados"; break;
case "BD": print "Bangladesh"; break;
case "BE": print "Belgium"; break;
case "BF": print "Burkina Faso"; break;
case "BG": print "Bulgaria"; break;
case "BH": print "Bahrain"; break;
case "BI": print "Burundi"; break;
case "BJ": print "Benin"; break;
case "BM": print "Bermuda"; break;
case "BN": print "Brunei"; break;
case "BO": print "Bolivia"; break;
case "BR": print "Brazil"; break;
case "BS": print "Bahamas"; break;
case "BT": print "Bhutan"; break;
case "BV": print "Bouvet Island"; break;
case "BW": print "Botswana"; break;
case "BY": print "Belarus"; break;
case "BZ": print "Belize"; break;
case "CA": print "Canada"; break;
case "CC": print "Cocos (Keeling) Islands"; break;
case "CD": print "Congo, Democratic People's Republic"; break;
case "CF": print "Central African Republic"; break;
case "CG": print "Congo, Republic of"; break;
case "CH": print "Switzerland"; break;
case "CI": print "Côte d'Ivoire"; break;
case "CK": print "Cook Islands"; break;
case "CL": print "Chile"; break;
case "CM": print "Cameroon"; break;
case "CN": print "China"; break;
case "CO": print "Colombia"; break;
case "CR": print "Costa Rica"; break;
case "CU": print "Cuba"; break;
case "CV": print "Cape Verde"; break;
case "CX": print "Christmas Island"; break;
case "CY": print "Cyprus"; break;
case "CZ": print "Czech Republic"; break;
case "DE": print "Germany"; break;
case "DJ": print "Djibouti"; break;
case "DK": print "Denmark"; break;
case "DM": print "Dominica"; break;
case "DO": print "Dominican Republic"; break;
case "DZ": print "Algeria"; break;
case "EC": print "Ecuador"; break;
case "EE": print "Estonia"; break;
case "EG": print "Egypt"; break;
case "EH": print "Western Sahara"; break;
case "ER": print "Eritrea"; break;
case "ES": print "Spain"; break;
case "ET": print "Ethiopia"; break;
case "FI": print "Finland"; break;
case "FJ": print "Fiji"; break;
case "FK": print "Falkland Islands (Malvina)"; break;
case "FM": print "Micronesia, Federal State of"; break;
case "FO": print "Faroe Islands"; break;
case "FR": print "France"; break;
case "GA": print "Gabon"; break;
case "GD": print "Grenada"; break;
case "GE": print "Georgia"; break;
case "GF": print "French Guiana"; break;
case "GG": print "Guernsey"; break;
case "GH": print "Ghana"; break;
case "GI": print "Gibraltar"; break;
case "GL": print "Greenland"; break;
case "GM": print "Gambia"; break;
case "GN": print "Guinea"; break;
case "GP": print "Guadeloupe"; break;
case "GQ": print "Equatorial Guinea"; break;
case "GR": print "Greece"; break;
case "GS": print "South Georgia and the South Sandwich Islands";
break;
case "GT": print "Guatemala"; break;
case "GU": print "Guam"; break;
case "GW": print "Guinea-Bissau"; break;
case "GY": print "Guyana"; break;
case "HK": print "Hong Kong"; break;
case "HM": print "Heard and McDonald Islands"; break;
case "HN": print "Honduras"; break;
case "HR": print "Croatia/Hrvatska"; break;
case "HT": print "Haiti"; break;
case "HU": print "Hungary"; break;
case "ID": print "Indonesia"; break;
case "IE": print "Ireland"; break;
case "IL": print "Israel"; break;
case "IM": print "Isle of Man"; break;
case "IN": print "India"; break;
case "IO": print "British Indian Ocean Territory"; break;
case "IQ": print "Iraq"; break;
case "IR": print "Iran"; break;
case "IS": print "Iceland"; break;
case "IT": print "Italy"; break;
case "JE": print "Jersey"; break;
case "JM": print "Jamaica"; break;
case "JO": print "Jordan"; break;
case "JP": print "Japan"; break;
case "KE": print "Kenya"; break;
case "KG": print "Kyrgyzstan"; break;
case "KH": print "Cambodia"; break;
case "KI": print "Kiribati"; break;
case "KM": print "Comoros"; break;
case "KN": print "Saint Kitts and Nevis"; break;
case "KP": print "North Korea"; break;
case "KR": print "South Korea"; break;
case "KW": print "Kuwait"; break;
case "KY": print "Cayman Islands"; break;
case "KZ": print "Kazakstan"; break;
case "LA": print "Laos"; break;
case "LB": print "Lebanon"; break;
case "LC": print "Saint Lucia"; break;
case "LI": print "Liechtenstein"; break;
case "LK": print "Sri Lanka"; break;
case "LR": print "Liberia"; break;
case "LS": print "Lesotho"; break;
case "LT": print "Lithuania"; break;
case "LU": print "Luxembourg"; break;
case "LV": print "Latvia"; break;
case "LY": print "Lybia"; break;
case "MA": print "Morocco"; break;
case "MC": print "Monaco"; break;
case "MD": print "Modolva"; break;
case "MG": print "Madagascar"; break;
case "MH": print "Marshall Islands"; break;
case "MK": print "Macedonia, Former Yugoslav Republic"; break;
case "ML": print "Mali"; break;
case "MM": print "Myanmar"; break;
case "MN": print "Mongolia"; break;
case "MO": print "Macau"; break;
case "MP": print "Northern Mariana Islands"; break;
case "MQ": print "Martinique"; break;
case "MR": print "Mauritania"; break;
case "MS": print "Montserrat"; break;
case "MT": print "Malta"; break;
case "MU": print "Mauritius"; break;
case "MV": print "Maldives"; break;
case "MW": print "Malawi"; break;
case "MX": print "Mexico"; break;
case "MY": print "Maylaysia"; break;
case "MZ": print "Mozambique"; break;
case "NA": print "Namibia"; break;
case "NC": print "New Caledonia"; break;
case "NE": print "Niger"; break;
case "NF": print "Norfolk Island"; break;
case "NG": print "Nigeria"; break;
case "NI": print "Nicaragua"; break;
case "NL": print "Netherlands"; break;
case "NO": print "Norway"; break;
case "NP": print "Nepal"; break;
case "NR": print "Nauru"; break;
case "NU": print "Niue"; break;
case "NZ": print "New Zealand"; break;
case "OM": print "Oman"; break;
case "PA": print "Panama"; break;
case "PE": print "Peru"; break;
case "PF": print "French Polynesia"; break;
case "PG": print "Papua New Guinea"; break;
case "PH": print "Philippines"; break;
case "PK": print "Pakistan"; break;
case "PL": print "Poland"; break;
case "PM": print "St. Pierre and Miquelon"; break;
case "PN": print "Pitcairn Island"; break;
case "PR": print "Puerto Rico"; break;
case "PS": print "Palestinian Territories"; break;
case "PT": print "Portugal"; break;
case "PW": print "Palau"; break;
case "PY": print "Paraguay"; break;
case "QA": print "Qatar"; break;
case "RE": print "Reunion"; break;
case "RO": print "Romania"; break;
case "RU": print "Russian Federation"; break;
case "RW": print "Twanda"; break;
case "SA": print "Saudi Arabia"; break;
case "SB": print "Solomon Islands"; break;
case "SC": print "Seychelles"; break;
case "SU": print "Sudan"; break;
case "SE": print "Sweden"; break;
case "SG": print "Singapore"; break;
case "SH": print "St. Helena"; break;
case "SI": print "Slovenia"; break;
case "SJ": print "Svalbard and Jan Mayan Islands"; break;
case "SK": print "Slovakia"; break;
case "SL": print "Sierra Leone"; break;
case "SM": print "San Marino"; break;
case "SN": print "Senegal"; break;
case "SO": print "Somalia"; break;
case "SR": print "Suriname"; break;
case "ST": print "São Tome and Principe"; break;
case "SV": print "El Salvador"; break;
case "SY": print "Syria"; break;
case "SZ": print "Swaziland"; break;
case "TC": print "Turks and Ciacos Islands"; break;
case "TD": print "Chad"; break;
case "TF": print "French Southern Territories"; break;
case "TG": print "Togo"; break;
case "TH": print "Thailand"; break;
case "TJ": print "Tajikistan"; break;
case "TK": print "Tokelau"; break;
case "TM": print "Turkmenistan"; break;
case "TN": print "Tunisia"; break;
case "TO": print "Tonga"; break;
case "TP": print "East Timor"; break;
case "TR": print "Turkey"; break;
case "TT": print "Trinidad and Tobago"; break;
case "TV": print "Tuvalu"; break;
case "TW": print "Taiwan"; break;
case "TZ": print "Tanzania"; break;
case "UA": print "Ukraine"; break;
case "UG": print "Uganda"; break;
case "UK": print "United Kingdom"; break;
case "UM": print "US Minor Outlying Islands"; break;
case "US": print "United States of America"; break;
case "UY": print "Uruguay"; break;
case "UZ": print "Uzbekistan"; break;
case "VA": print "Vatican City"; break;
case "VC": print "Saint Vincent and the Grenadines"; break;
case "VE": print "Venezuela"; break;
case "VG": print "British Virgin Islands"; break;
case "VI": print "US Virgin Islands"; break;
case "VN": print "Vietnam"; break;
case "VU": print "Vanuatu"; break;
case "WF": print "Wallis and Futuna Islands"; break;
case "WS": print "Western Samoa"; break;
case "YE": print "Yemen"; break;
case "YT": print "Mayotte"; break;
case "YU": print "Yugoslavia"; break;
case "ZA": print "South Africa"; break;
case "ZM": print "Zambia"; break;
case "ZR": print "Zaire"; break;
case "ZW": print "Zimbabwe"; break;
default: print "No Country Corresponds to that Code";
}
}
?>"> <b>«</b> Result
</form>