我有一个按钮列表,每个按钮都传递不同的值。代码应将此值存储为变量或会话,然后将其传递给更新值的表行的函数。我尝试将此值存储为变量,然后将其传递,但这不起作用,所以我想我会把它变成一个会话。这也没用,不知道从哪里开始。
这是一个按钮示例:
<tr>
<td data-title="Name"><a href="#"><img src="banner.jpg" width="400"></a></td>
<td data-title="Link">
<form name="first" action="pending.php" method="POST"><input type="hidden" name="xz" value="one"><a class="mbutton" onclick="document.forms['first'].submit();">Gedaan</a></form>
</td>
<td data-title="Status"><p class="ptable"><?= $fgmembersite->One(); ?></p></td>
</tr>
这是表单所在的位置:
<?PHP
include("./include/membersite_config.php");
$_SESSION['postdata'] = $_POST;
$bname = $_SESSION['postdata'];
if($fgmembersite->Pending($bname))
{
$fgmembersite->RedirectToURL("index.php");
}
?>
所以这应该将$ bname传递给函数Pending()。
这里有待处理:
function Pending($bname)
{
if(!$this->DBLogin())
{
$this->HandleError("Database login failed!");
return false;
}
$result = mysql_query("Select * from $this->tablename where confirmcode='y'",$this->connection);
if(!$result || mysql_num_rows($result) <= 0)
{
$this->HandleError("Error");
return false;
}
$row = mysql_fetch_assoc($result);
$ux = $row['username'];
$ustat = $row['one'];
$bname = $_SESSION['postdata']['xz'];
$qry = "Update $this->tablename Set $bname='In behandeling' Where username='$ux'";
if(!mysql_query( $qry ,$this->connection))
{
$this->HandleDBError("Error inserting data to the table\nquery:$qry");
return false;
}
return true;
}
答案 0 :(得分:0)
所以你说Pending函数返回TRUE,并将你重定向到membership.php?或index.php(或者这些是相同的) -