“Index.php?网页”功能不正常
因此,我试图访问我的网站内的某个网页 在我的索引中,我使用isset$\u GET参数访问另一个页面。我的index.php代码如下所示:“Index.php?网页”功能不正常,php,post,get,isset,Php,Post,Get,Isset,因此,我试图访问我的网站内的某个网页 在我的索引中,我使用isset$\u GET参数访问另一个页面。我的index.php代码如下所示: <!DOCTYPE html> <html> <head> <?php require ("includes/database.php"); ?> <title>Offstreams Admin Panel</title> <link rel="styles
<!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?页面不存在时,我的echo页面不可用。但是当它确实存在时,比如index.php?post_new_下面的带代码,则不会发布任何内容。服务器和数据库工作,这是肯定的。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>
您只能使用一次请求密钥-因此不要在同一请求中使用$\u GET['post\u new\u band']和$\u post['post\u new\u band']。更改其中一个键。这很愚蠢,但事实证明这是一个涉及分号的语法错误*打在脸上