Hi,
The previous issue is solved and it is not the root problem.
I tried to retrieve db data and put it in the drop down box.
Everything appears fine to me, but it does not show the selected value in the drop down box.
I copy the whole html code to display it and it works! The selected value appears in the drop down box.
I do not know why when i generate the html code for drop down box, the selected value did not appear!?
Both the generated html code and embedded html code looks the same to me.
Any idea?
<html>
Country
<?php
echo "<select id=\"element_6\" name=\"element_6\" class=\"element select medium\">\n";
echo " <option value=\"\"></option>\n";
$sql = "SELECT country, country_name FROM wsd_countries ORDER BY country_name ASC";
$result = mysql_query($sql) or die('Error, query failed');
while($arrayRow = mysql_fetch_assoc($result))
{ $strAA = $arrayRow["country"];
$strBB = $arrayRow["country_name"];
$strA = strtoupper($strAA);
$strB = strtoupper($strBB);
if ($strB == $country)
{ echo " <option value=\"$strA\" selected>$strB</option>\n";
}
else
{ echo " <option value=\"$strA\">$strB</option>\n";
}
}
echo "</select>";
?>
</html>