首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Bootstrap Down - Not Down Down When id in URL

Bootstrap Down - Not Down Down When id in URL
EN

Stack Overflow用户
提问于 2020-12-29 05:13:13
回答 1查看 14关注 0票数 0

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

举个例子,如果我在http://localhost/degs/serpstudentsinclass.php?id=3,如果我点击Admin下拉菜单,什么都不会发生。如果我单击返回到主页http://localhost/degs/index.php,管理下拉菜单开始工作没有问题。

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

有什么想法可以解释为什么会这样吗?

头文件

代码语言:javascript
复制
<?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>

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

代码语言:javascript
复制
<?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>
EN

回答 1

Stack Overflow用户

发布于 2020-12-29 05:58:34

我想通了!我没有在最后加上我的页脚!希望这篇文章能帮助任何遇到这个问题的人!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65484155

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档