我在“module.php”脚本下面有这段代码,它在每个 ModuleId 和 Module Name 的下拉菜单中显示选项:
$sql = "
SELECT cm.CourseId, cm.ModuleId,
c.CourseName,
m.ModuleName
FROM Course c
INNER JOIN Course_Module cm ON c.CourseId = cm.CourseId
JOIN Module m ON cm.ModuleId = m.ModuleId
WHERE
(c.CourseId = ?)
ORDER BY c.CourseId, m.ModuleId
";
$sqlstmt=$mysqli->prepare($sql);
$sqlstmt->bind_param("s",$course);
$sqlstmt->execute();
$sqlstmt->bind_result($dbCourseId,$dbModuleId,$dbCourseName,$dbModuleName);
$moduleHTML = "";
while($sqlstmt->fetch()) {
$moduleHTML .= "<option value='$dbModuleId'>" . $dbModuleId . " - " . $dbModuleName . "</option>".PHP_EOL;
}
echo $moduleHTML;
$sqlstmt->execute();
现在我想在单独的页面 (editsession.php) 上回显 ModuleId 和 Module Name,现在我已经设法回显 Module Id 但我的问题是如何在另一个页面上回显模块名称?
$moduleHTML = "";
$moduleHTML .= '<select name="modules" id="modulesDrop">'.PHP_EOL;
$moduleHTML .= '<option value="">Please Select</option>'.PHP_EOL;
$moduleHTML .= '</select>';
if (isset($_POST['moduleSubmit'])) {
$outputmodule = "";
$outputmodule = "<p><strong>Module:</strong> " . $_POST['modules'] . " - " . "" . "</p>";