我正在使用Jquery Mobile 创建一个弹出表单,用于显示供用户选择的 select 语句。我正在使用ajax使select语句动态化。我已经成功地展示了数据并创建了新的 select 语句,但它似乎格式不正确。
表格之前和之后的图片: Picture of The Form with before and After 弹出表单代码: Popup Form Code
表格之前和之后的图片: Picture of The Form with before and After 弹出表单代码: Popup Form Code
<?php
$q = intval($_GET['q']);
include_once('session.php');
include_once('dbConnect.php');
$sql="SELECT Enrollment.c_id, Enrollment.s_id, users.f_name, users.l_name
FROM Enrollment
INNER JOIN users ON Enrollment.s_id = users.s_id
WHERE c_id=$q";
$result = mysqli_query($dbc, $sql);
echo "<label for='selectuser' class='select'>Select user:</label>";
echo "<select name='selectuser' id='selectuser' data-native-menu='false'>";
echo "<option>Choose Users:</option>";
echo "<option value='instructor'>All Instructors</option>";
echo "<option value='students'>All Students</option>";
while($row = mysqli_fetch_array($result))
{
$s_id = $row['s_id'];
$f_name = $row['f_name'];
$l_name = $row['l_name'];
echo "<option value='$s_id'>$f_name $l_name</option>";
}
echo "</select>";
?>
$("#selectuser")
,可以通过将其缓存到一个变量中而不是重新选择来稍微改进它。 - rlemon