我想知道是否可以为从数据库查询数据的选择下拉列表设置标题(即选择名称)。非常感谢
当前代码:
<select>
<?php
include("db.php";)
$sql = SELECT * FROM Persons;
$result = mysqli_query($con,$sql);
while ($row = mysqli_fetch_assoc($result)) {
echo "<option value='" . $row['name'] . "'>" . $row['name'] . "</option>";}?>
</select><br>
期望效果
<select>
<option value="default">Select Name</option>
<option value="Tom">Tom</option>
<option value="Mary">Mary</option>
<option value="John">John</option>
</select><br>
答案 0 :(得分:2)
只需将array([[ 2.61126134e+08],
[ 2.37858792e+08],
[ 2.32792708e+08],
...,
[ 2.92302961e+08],
[ 2.24309513e+08],
[ 1.83542358e+08]])
array([[ 34.7],
[ 31.7],
[ 30.5],
...,
[ 140.8],
[ 142.5],
[ 146.3]])
添加到其他选项中:
<option value="default">