这是我的代码:
<?php
$hostname = "localhost";
$username = "root";
$password = "";
$databasename = "change_management";
$connect = mysqli_connect($hostname, $username, $password, $databasename);
$query3 = "SELECT `change_id` FROM `change_request_tbl` WHERE `review_by` IS NULL";
$result = mysqli_query($connect,$query3);
?>
<select name="change_id">
<?php
while ($row = mysqli_fetch_array($result))
{
echo "<option value='".$row['change_id']."'</option>";
}
?>
</select>
如您所见,我正在尝试使用change_id
值填充下拉菜单,其中字段review_by
为空。目前,下拉菜单中有空白值。
我做错了什么?
答案 0 :(得分:2)
您在<option>Your value here</option>
尝试更改
echo "<option value='".$row['change_id']."'</option>";
要
echo "<option value='".$row['change_id']."'>".$row['change_id']."</option>";