I have this PHP code that I use to make a dropdown form selection of country's I would like to eliminate this extra mysql query though and just store the output like in code to on the page However I am lost on how I would have the users country SELECTED If I do not use the query to get the data Please advice
<select name="country" style="width:180px;" onChange="do_get_rest_popup(this.value)" o>
<?PHP
$sql="SELECT * FROM users_countries ORDER BY country";
$result_country = executequery($sql);
while($line_country = mysql_fetch_array($result_country)){
$db_country_id = $line_country['id'];
$country_name = $line_country['country'];
?>
<option value="<?=$db_country_id?>"<? if($line_member['country']==$db_country_id){ echo " SELECTED";} ?>><?=$country_name?></option>
<?
}
?>
</select>
Code about outputs this on page, I have strunk the quantity of countries down for this post
<select name="country" style="width:180px;" onChange="do_get_rest_popup(this.value)" o>
<option value="217">Turkmenistan</option>
<option value="218">Turks and Caicos Islands</option>
<option value="219">Tuvalu</option>
<option value="220">Uganda</option>
<option value="221">Ukraine</option>
<option value="222">United Arab Emirates</option>
<option value="223">United Kingdom (Great Britain)</option>
<option value="224" SELECTED>United States</option>
</select>