我们正在使用的以下代码。请检查并更新:
` 仪表板
</div>
<div class="form-group">
<label for="to_user">Turbine</label>
<select name="to_user" class="form-control">
<option value="pick">--Select All--</option>
<option> <?php
$query = "SELECT DISTINCT Turbine FROM [JMDWF].[dbo].[TENAVG]";
$sql = sqlsrv_query($link,$query);
$row = sqlsrv_num_rows($sql);
$menu = "";
echo "<select name='to_user'>";
while ($row = sqlsrv_fetch_array($sql)){
/* echo "<option value='". $row['Turbine'] ."'>" .$row['Turbine'] ."</option>" ;*/
$menu.="<option>".$row['Turbine']."</option>";
}
echo "$menu";
?>
</option>
</select>
</div>`
我们仍然从下拉列表中获取输出。我需要在下拉列表中显示值。
答案 0 :(得分:0)
您正在将PHP的输出打印到html的<option></option>
节点中 - 它将不可见。
请改为尝试:
<div class="form-group">
<label for="to_user">Turbine</label>
<?php
$query = "SELECT DISTINCT Turbine FROM [JMDWF].[dbo].[TENAVG]";
$sql = sqlsrv_query($link,$query);
$row = sqlsrv_num_rows($sql);
$menu = "";
echo "<select name='to_user'>";
echo "<option value='pick'>--Select All--</option>";
while ($row = sqlsrv_fetch_array($sql)){
/* echo "<option value='". $row['Turbine'] ."'>" .$row['Turbine'] ."</option>" ;*/
$menu.="<option>".$row['Turbine']."</option>";
}
echo "</select>";
echo "$menu";
?>
</div>`