I have a select menu that displays countries. It looks at the DB and judging by the value in the db shows the option as selected. Is there a simpler way off doing this than:
if ($country == 'AG') {echo '<option value="AG" selected="selected">Antigua</option>';}
else {echo '<option value="AG">Antigua</option>';};
if ($country == 'AR') {echo '<option value="AR" selected="selected">Argentina</option>';}
else {echo '<option value="AR">Argentina</option>';};
if ($country == 'AM') {echo '<option value="AM" selected="selected">Armenia</option>';}
else {echo '<option value="AM">Armenia</option>';};
if ($country == 'AW') {echo '<option value="AW" selected="selected">Aruba</option>';}
else {echo '<option value="AW">Aruba</option>';};
if ($country == 'AU') {echo '<option value="AU" selected="selected">Australia</option>';}
else {echo '<option value="AU">Australia</option >';};
if ($country == 'AT') {echo '<option value="AT" selected="selected">Austria</option>';}
else {echo '<option value="AT">Austria</option>';};
if ($country == 'AZ') {echo '<option value="AZ" selected="selected">Azerbaijan</option>';}
else {echo '<option value="AZ">Azerbaijan</option>';};
if ($country == 'BS') {echo '<option value="BS" selected="selected">Bahamas</option>';}
else {echo '<option value="BS">Bahamas</option>';};
if ($country == 'BH') {echo '<option value="BH" selected="selected">Bahrain</option>';}
else {echo '<option value="BH">Bahrain</option>';};
There are a lot of countries and doing this would be madness wouldn't it????