<select> Default Value
This question already has an answer here:
You don't use an argument $x
of your Types
function which as i guess is a selected value. Try to replace your function with this code:
function Types($x) {
global $mysqli;
$type = " SELECT type FROM types ";
if ($type_results = $mysqli->query($type)) {
while ($row = $type_results->fetch_assoc()) {
$selected = ($row["type"] == $x) ? 'selected="selected"' : '';
printf ("<option %s>%s</option>", $selected, $row["type"]);
}
$type_results->free();
}
}
and of course provide selected value to function Types
in your html code.
上一篇: 无法识别选择选项菜单的默认值
下一篇: <select>默认值