我希望用户点击下拉列表并选择考试类型。只有与该ID相关的特定记录才会显示在表格中。 我下面有两张图片是图片。
<select name="exam_type_id">
<option value="Select">Select</option>
<?php
$result= new exam();
$res=$result->selectExam();
while($t=mysqli_fetch_array($res))
{
?>
<option value="<?php echo $t['exam_type_id']?>">
<?php echo $t['name']; ?></option> <?php }?>
</select>
</form>
<div class="inside">
<table width="605" height="70" border="2" bordercolor="#666666">
<tr>
<td><strong>Class Name</strong></td>
<td><strong>Subject</strong></td>
<td><strong>Start Date</strong></td>
<td><strong>End Date</strong></td>
<td><strong>Room No</strong></td>
<td><strong>Add</strong></td>
<td><strong>Edit</strong></td>
<td><strong>Delete</strong></td>
</tr>
<?php
$result= new exam();
$res=$result->selectExamAll();
while($res1=mysqli_fetch_array($res))
{ ?>
<td><?php echo $res1["className"]; ?> </td>
<td><?php echo $res1["subject"]; ?></td>
<td><?php echo $res1["startDate"]; ?></td>
<td><?php echo $res1["endDate"]; ?></td>
<td><?php echo $res1["roomNo"]; ?></td>
<td><a href="addExam.php"><img src="images/add.jpg" width="20" height="20"/></a></td>
<td>
<a href="addExam.php">
<img src="images/add.jpg" width="20" height="20"/></a>
</td>
<td><a href="addExam.php"><img src="images/add.jpg" width="20" height="20"/></a></td>
</tr>
<?php } ?>
</table>
<p class="p0">
</p>enter code here
</div>
exam_type_id 是 exam_type 表中的外键。我在 exam_type 表的下拉列表中显示考试类型。当用户点击来自exam_type表的下拉数据时,基于所选id的特定数据应该显示在html表中。 exam_type_id 来自 exam_type 表,其在考试table.id中的外键将来自 exam_type 下拉列表,数据将显示在考试表中html表。