Is there anyway I can easily get the country name from the 2 letter country code.
I am populating a dropdown from the values stored in a table for country, however these are stored as NZ, US, etc. Is there a simple way I can do this without populating a table with code/name matches and doing a join?
//get countries
$countryMap = array();
$countryMap[""] = "ALL COUNTRIES";
$sql = new SQLQuery();
$sql->select = array(
'Country'
);
$sql->from = array(
'Member'
);
$sql->where = array(
"Country !='' AND Country IS NOT NULL"
);
$sql->orderby('Country');
$result = $sql->execute();
foreach($result as $row){
$countryMap[$row['Country']] = $row['Country'];
}
return new FieldSet(
new LiteralField('Countries',"<b>Selected Countries:".$this->MemberCountry."</b>"),
new ListboxField('MemberCountry','Country',$countryMap,'',null,true)
);