第一个下拉列表应选择所有学期数据,并且有效。对于第二个下拉列表,它应该选择所有student_prg数据,但它不起作用(下拉列表为空)。有什么方法可以让它发挥作用吗?如果有任何其他方法可以使下拉菜单正常工作,请告诉我。配置.php<?php define('DBINFO','mysql:host=localhost;dbname=marketing_system');define('DBUSER','root');define('DBPASS','');$conn = mysqli_connect("localhost","root","","marketing_system");?>测试报告.php<div class="modal-body"> <div class="form-group"> <label for="title">Select Semester:</label> <select name="semester" class="form-control"> <option value="">--- Select Semester ---</option> <?php require('../setting/config.php'); $query = "SELECT DISTINCT semester FROM marketing_data ORDER BY semester DESC"; $do = mysqli_query($conn, $query); while($row = mysqli_fetch_array($do)){ echo '<option value="'.$row['student_matric'].'">'.$row['semester'].'</option>'; } ?> </select> </div> <div class="form-group"> <label for="title">Select Programme:</label> <select name="prg" class="form-control"> <option value="">--- Select Programme ---</option> <?php require('../setting/config.php'); $query2 = "SELECT DISTINCT student_prg FROM marketing_data ORDER BY student_prg DESC"; $do = mysqli_query($conn, $query2); var_dump($do); die(); while($row = mysqli_fetch_array($do)){ echo '<option value="'.$row['student_matric'].'">'.$row['student_prg'].'</option>'; } ?> </select> </div>
- 1 回答
- 0 关注
- 109 浏览
添加回答
举报
0/150
提交
取消