我有一个充满成员列表 ( listmembers.php
) 的表格,其中一列如下所示:
但是,当我现在点击禁令!或立即解禁!该页面引用dobanunban.php
并显示
注意:未定义变量:第 5 行 C:\xampp\htdocs\AM\control\dobanunban.php
中的状态指的是$status = $_REQUEST['status'];
我有以下代码listmembers.php
<?php
session_start();
include("control/connect.php");
if(!empty($_SESSION['usernameonline'])){
if($_SESSION['usernameonline'] == NULL || $_SESSION['usernameonline'] == ""){
header("location:index.php");
}
}
if(empty($_REQUEST['username'])){
$username = "";
}else{
$username = $_REQUEST['username'];
}
$query = NULL;
$query = "select image,username,fullname,email,phone,status from member where username <> 'admin'";
$result = mysql_query($query);
?>
/----------------------------/
<td>
<?php echo $row['status'];?>
<br/>
<a id="status" href="control/dobanunban.php?username=<?php
echo $row['username'];
echo $row['status'];
?>">
<?php
if($row['status']=='banned'){
echo "Unban now!";}
else{ echo "Ban now!";}
?>
</a>
</td>
这在我的dobanunban.php
:
<?php
include("connect.php");
$username = $_REQUEST['username'];
$status = $_REQUEST['status'];
if($status=="unbanned"){
$query1 = "update member SET Status = 'banned' WHERE username='$username';";
mysql_query($query1);
header("location:../listmembers.php?err=Success ban member");
}else if($status=="banned"){
$query2 = "update member SET Status = 'unbanned' WHERE username='$username';";
mysql_query($query2);
header("location:../listmembers.php?err=Success unban member");
}
看起来$status
没有从listmembers.php
回声中获得价值。我的错误是什么?我该怎么办?