第一個下拉列表應(yīng)選擇所有學(xué)期數(shù)據(jù),并且有效。對于第二個下拉列表,它應(yīng)該選擇所有student_prg數(shù)據(jù),但它不起作用(下拉列表為空)。有什么方法可以讓它發(fā)揮作用嗎?如果有任何其他方法可以使下拉菜單正常工作,請告訴我。配置.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>
第二個下拉列表為空
寶慕林4294392
2023-04-21 16:31:15