Hi I have a countries and states php file that holds the abbrev. and names for states and countries. can someone assist me with creating an html <option> field to display the Country names in and as a value the countries abbrev. and the same would apply to the States.
Countries:
<OPTION value="US">United States</OPTION>
States:
<OPTION value="AL">Alabama</OPTION>
Also another question to save from having to post twice. once the values are saved into my database m_state and m_country how can I grab the full state/country name after i do a query? So i a user has m_state = AL and m_country = US how can i access the countries_states.php and echo/print Alabama and United States
thanks in advance
countries_states.php
<?php
$countries['AD'] = array(name => 'Andorra', lat => 42, lon => 1);
$countries['AE'] = array(name => 'United Arab Emirates', lat => 24, lon => 54);
$countries['AF'] = array(name => 'Afghanistan', lat => 34, lon => 69);
// ... more shorten
//sort countries alphabetically
function sortby($a, $b) {
if ($a[name] == 'United States') return -1;
if ($a[name] == $b[name]) return 0;
return ($a[name] > $b[name]) ? -1 : 1;
}
uasort($countries,"sortby");
$countries['US'] = array(name => 'United States', lat => 39, lon => -93, z => 3);
$countries = array_reverse($countries, true);
$states['US']['AL'] = 'Alabama';
$states['US']['AK'] = 'Alaska';
$states['US']['AZ'] = 'Arizona';
// ... more shorten
?>