I'm working on a site where the user can select his country, for now I've created an array which contains alla nation names and relative codes like it code for Italy:\[code\]<?php$nations[] = array ("code" => "af", "name" => "Afghanistan");$nations[] = array ("code" => "ax", "name" => "Aland Islands");$nations[] = array ("code" => "al", "name" => "Albania");$nations[] = array ("code" => "dz", "name" => "Algeria");$nations[] = array ("code" => "as", "name" => "American Samoa");$nations[] = array ("code" => "ad", "name" => "Andorra");$nations[] = array ("code" => "ao", "name" => "Angola");$nations[] = array ("code" => "ai", "name" => "Anguilla");$nations[] = array ("code" => "aq", "name" => "Antartica");$nations[] = array ("code" => "ag", "name" => "Antigua and Barbuda");$nations[] = array ("code" => "ar", "name" => "Argentina");$nations[] = array ("code" => "am", "name" => "Armenia");$nations[] = array ("code" => "aw", "name" => "Aruba");$nations[] = array ("code" => "au", "name" => "Australia");$nations[] = array ("code" => "at", "name" => "Austria");$nations[] = array ("code" => "az", "name" => "Azerbaijan");$nations[] = array ("code" => "bs", "name" => "Bahamas");$nations[] = array ("code" => "bh", "name" => "Bahrain");$nations[] = array ("code" => "bd", "name" => "Bangladesh");// etc... for 245 array elements?>\[/code\]when I load the page where user can select his country I use a function to print all the data:\[code\]<?phpfunction get_nation_name ($code = "") { global $nations; for ($n = 0; $n < count ($nations); $n ++) { if ($code == $nations[$n]["code"]) return $nations[$n]["name"]; }}function nation_select_option ($attributes, $code = "") { global $nations; $nation_name = get_nation_name ($code); $html = " <select $attributes>\r"; for ($n = 0; $n < count ($nations); $n ++) { if ($nation == $nations[$n]["code"]) $html .= " <option selected=\"selected\" value='".$nations[$n]["code"]."'>".$nations[$n]["name"]."</option>\r"; else $html .= " <option value='".$nations[$n]["code"]."'>".$nations[$n]["name"]."</option>\r"; } $html.= " </select>\r"; return $html;}?>\[/code\]this is useful, because if the user has already chosen a nation, he can load the entire list with the previous one selected, but it's not properly light!should I use another way to do that or could it be enough optimized?\[code\]<?phpprint nation_select_option ('id="my_css_id"', "ar"); // ar => Argentina code?>\[/code\]