您好,我已经用 php 填充了一个下拉列表。
它看起来像这样:-
$con=mysqli_connect("localhost","clinic","myclinic","myclinic");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$query="SELECT DISTINCT doctor FROM schedule";
$result = mysqli_query($con, $query);
echo "<br><br>
<table border='1'><tr>
<td> Doctor's Name </td>
<td> <select name='doctor'>";
while($row = mysqli_fetch_array($result))
{
echo "<option value='" . $row['doctor'] . "'>" . $row['doctor'] ."</option>";
}
echo "</select>";
现在我的页面上多了几个下拉列表。当我从列表中选择一名医生时,我想运行一个脚本 例如,在选择一名医生时,List Days 应该填充医生可用的天数。执行查询
SELECT days from appointments WHERE doctor="One who was selected";
我怎样才能做到这一点?
谢谢