I have a Select list being populated from a database. I would like to have a default value as one of the options.
What is wrong with this code? $location is the value I want set. $myrow is pretty self explanatory
print "<td><select name='chg_loc'>";
print "<option value = '$location'></option>";
$result_loc = mysql_query("SELECT DISTINCT co_name from hosting_co ORDER by co_name"
;
while ($myrow = mysql_fetch_array($result_loc)) {
printf('<option value="%s">%s %s', $myrow["co_name"], $myrow["co_name"], "\n"
;
}
print '</select></td>';
What is wrong with this code? $location is the value I want set. $myrow is pretty self explanatory
print "<td><select name='chg_loc'>";
print "<option value = '$location'></option>";
$result_loc = mysql_query("SELECT DISTINCT co_name from hosting_co ORDER by co_name"

while ($myrow = mysql_fetch_array($result_loc)) {
printf('<option value="%s">%s %s', $myrow["co_name"], $myrow["co_name"], "\n"

}
print '</select></td>';