Php 引导下拉列表-在URL中显示id时不下拉

Php 引导下拉列表-在URL中显示id时不下拉,php,bootstrap-4,Php,Bootstrap 4,在我正在建设的网站上遇到了一个有趣的问题。当我到达包含id的url时,其中一个选项的下拉菜单将停止工作 举个例子,如果我在http://localhost/degs/serpstudentsinclass.php?id=3,如果单击“管理”下拉列表,则不会发生任何事情。如果我点击返回主页http://localhost/degs/index.php,管理员下拉菜单开始工作没有问题 在使用移动设备工作时,这也增加了一个额外的问题。一旦你到达http://localhost/degs/serpstu

在我正在建设的网站上遇到了一个有趣的问题。当我到达包含id的url时,其中一个选项的下拉菜单将停止工作

举个例子,如果我在http://localhost/degs/serpstudentsinclass.php?id=3,如果单击“管理”下拉列表,则不会发生任何事情。如果我点击返回主页http://localhost/degs/index.php,管理员下拉菜单开始工作没有问题

在使用移动设备工作时,这也增加了一个额外的问题。一旦你到达http://localhost/degs/serpstudentsinclass.php?id=3,您将完全失去使用导航菜单的能力(因为现在由于屏幕大小,它是一个完整的下拉菜单)。因此,您必须再次返回index.php,然后菜单将再次开始工作

你有没有想过为什么会这样

头文件

<?php
// session file
include_once 'includes/session.php';?>
<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="../css/site.css" />
    <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">




    <title><?php echo $title ?></title>

</head>
<body>
<div class="container">
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
        <a class="navbar-brand" href="index.php">DEGS</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav mr-auto">
                <li class="nav-item">
                    <a class="nav-link" href="index.php">Home</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="serpentine.php">Serpentine</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="uturn_box.php">U-Turn Box</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="blocked_evasive.php">Blocked Evasive</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="forward_reverse.php">Forward Reverse</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="controlled_braking.php">Controlled Braking</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="cumulative_skills_day.php">Cumulative Skills - Day</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="cumulative_skills_night.php">Cumulative Skills - Night</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="evoc_challenge.php">Evoc Challenge</a>
                </li>
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"  data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        Admin
                    </a>
                    <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                        <a class="dropdown-item" href="users.php">Users</a>
                        <a class="dropdown-item" href="classes.php">Classes</a>
                        <a class="dropdown-item" href="students.php">Students</a>
                        <a class="dropdown-item" href="legends.php">Legend</a>
                        <a class="dropdown-item" href="tests.php">Tests</a>
                    </div>
                </li>
            </ul>
            <ul class="navbar-nav ml-auto">
                <li class="nav-item active">
                    <?php
                    if(!isset($_SESSION['userid'])){
                        ?>
                        <a class="nav-link" href="login.php">Login <span class="sr-only">(current)</span></a>
                    <?php } else { ?>
                <li class="nav-item"><a class="nav-link" href="logout.php">Logout <span class="sr-only">(current)</span></a></li>
                <?php } ?>
                </li>
            </ul>
        </div>
    </nav>

问题开始的页面-其他页面遵循类似的模式,您可以选择班级以获取学生列表

<?php
$title = "DEGS - Students";
require_once 'includes/header.php';
require_once 'includes/auth_check.php';
require_once 'db/conn.php';

if(!isset($_GET['id'])){
    echo 'error';
} else {
    $id = $_GET['id'];
    $results = $admin->getStudents($id);
    $class = $admin->getClassDetails($id);
    $students = $admin->getStudents($id);


}
?>
<h1>Serpentine - Class <?php echo $class['class']?></h1>

<br/>
<br/>
<table class="table">
    <tr>
        <th>Last Name</th>
        <th>First Name</th>
        <th>Agency</th>
        <th>Class</th>
        <th># of Attempts</th>
        <th>Student Operations</th>
    </tr>
    <?php while($r = $results->fetch(PDO::FETCH_ASSOC)) { ?>
        <tr>
            <td><?php echo $r['lname']?></td>
            <td><?php echo $r['fname']?></td>
            <td><?php echo $r['agency']?></td>
            <td><?php echo $class[1]?></td>
            <td><?php echo $serpentine->getAttemptCount($r['student_id']) ?></td>
            <td>
                <a href="serpview.php?id=<?php echo $r['student_id']?>" class="btn btn-primary">View Attempts</a>
                <a href="serpadd.php?id=<?php echo $r['student_id']?>" class="btn btn-success">Add Attempt</a>
            </td>
        </tr>
    <?php }?>
</table>

蛇形类


姓 名字 机构 等级 #尝试次数 学生操作
我想出来了!我没有在结尾加上我的页脚!希望这能帮助其他遇到这个问题的人