";索引.php?网页”;功能不正常


"Index.php?webpage" Not Functioning properly

所以我正在尝试访问我的网站中的某个网页。

在我的索引中,我使用isset($_GET)参数来访问另一个页面。我的index.php代码如下:

<!DOCTYPE html>
<html>
<head>
    <?php require ("includes/database.php"); ?>
    <title>Offstreams Admin Panel</title>
    <link rel="stylesheet" type="text/css" href="styles/admin_body.css" />
    <link rel="stylesheet" type="text/css" href="styles/admin_header.css" />
    <link rel="stylesheet" type="text/css" href="styles/admin_footer.css" />
    <link rel="stylesheet" type="text/css" href="styles/admin_postspace.css" />
</head>
<body>
    <header>
        <!--Header Info Here -->
    </header>
    <div class="wrapper">
        <div class="sidebar">
            <ul>
                <li><a href="index.php?post_new_band">Post New Band</a></li>
            </ul>
        </div>
        <article>
            <?php
                if (isset($_GET['post_new_band'])){
                    require ("includes/post_new_band.php");
                    echo "Page accessed";
                } else {
                    echo "Page not accessible."; 
                }       
            ?>
        </article>
    </div>
</body>
</html>

当"index.php?page"不存在时,它的echo页面不可用。但当它确实存在时,比如"index.php?post_new_band"(下面的代码),就不会发布任何内容。服务器和数据库可以工作,这是肯定的。MySQL不是问题,因为我正在尝试让html工作。

"post_new_band.php"的代码:

<!DOCTYPE html>
<html>
<head>
    <!-- Head Info Goes Here -->
</head>
<body>
   <h1>Insert New Band</h1>
       <form action='index.php?post_new_band' method='post'>
           <b>Insert New Band</b><input type='text' name='band_name' />
           <b>Insert Band Origin</b><input type='text' name='band_origin' />
           <input type='submit' name='insert_band' value='Add Band' />
       </form>
   <?php
       if (isset($_POST['post_new_band'])){
           $band_name = $_POST['band_name'];
           if($band_name==''){
               echo "<script>alert ('Please Insert Band Name')</script>";
               echo "<script>window.open('index.php?post_new_band','_self')</script>"
           } else {
               $insert_band_name = "insert into Band  (band_name) values ('$band_name')";
               $run_band_name = mysql_query("$insert_band_name");
               echo "<script>alert ('New Category Added')</script>";
               echo "<script>window.open('index.php?post_new_band','_self')</script>"
           }
       }
   ?>
</body>
</html>

您只能使用一次请求密钥,因此不要在同一请求中使用$_GET['post_new_band']$_POST['post_new_band']。换一把钥匙。

这很愚蠢,但事实证明这是一个涉及分号的语法错误*拍打脸部。