PHP Tutorial : Country list array

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/

2 Responses to “PHP Tutorial : Country list array”

  1. Mike Harrison Says:

    Not useful at all, this is an outdated list – for example, it contains Yugoslavia !


  2. admin Says:

    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.


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>