PHP Tutorial : Country list array
Jun 17, 2009 Useful PHP
In my point of view, a very useful and common thing we need when we build for example a membership site it’s country list array. I will do it within next function then will show how to use it :
Click here to get the function
And here’s how to use it for example to generate a select (drop down) with options to list countries:
<?php $countryList = countryArray(); print "<select name=\"countryList\">"; foreach($countryList as $simbol => $country) { print "<option value=\"$simbol\">$country</option>\n"; } print "</select>"; ?>
Simply useful! But have also a look here: http://readytousesolutions.com/phpblog/tag/php-detect-country/
Tags: countries array, country array, php countries, php countries array, php country array, php country drop down, php country list, php country list array


September 9th, 2009 at 3:17 pm
Not useful at all, this is an outdated list – for example, it contains Yugoslavia !
September 9th, 2009 at 3:20 pm
Sorry it wasn’t useful, and thanks for reporting. This blog switched hands and I’m still reviewing and updating the older posts. This will be prioritized.