i have a select box which display all the countries. when user register, they will need to choose they are from which country.
my problem is when retrieve out the country for display purpose. how am i suppose to do it?
this is part of the code:
for normal select box, i will do something like this when retrieving..
i dowan to use this way because the country list is too long. if ihave to use this method, i wil have to do if statement for each and every country.
is there any alternative ways that i can do? shorter method?? better ways?? pls help!
my problem is when retrieve out the country for display purpose. how am i suppose to do it?
this is part of the code:
PHP Code:
echo "<SELECT class=ft1 name=country>";
echo "<option>Please Select</option>";
echo "<option value=AF>Afghanistan</option>";
echo "<option value=AL>Albania</option>";
echo "<option value=DZ>Algeria</option>";
PHP Code:
echo "<option ";
if ($country == '')
echo "selected";
echo ">";
echo "<option value=AF ";
if ($country == 'AF')
echo "selected";
echo " >Afghanistan";
echo "<option value=AL ";
if ($country == 'AL')
echo "selected";
echo " >Albania";
echo "</option>";
is there any alternative ways that i can do? shorter method?? better ways?? pls help!

Comment