gpt4 book ai didi

单击按钮后 PHP isset 不起作用

转载 作者:行者123 更新时间:2023-11-29 12:06:21 26 4
gpt4 key购买 nike

出于某种原因,当我单击取消按钮时,它应该运行 Cancel isset mysql 查询,但事实并非如此。当我将其设置为 $_GET 而不是 $_POST 时,它仅通过 mysql 查询。不完全确定发生了什么。

if(isset($_POST["Cancel"])) {
$sCancel = $dbh->prepare("
UPDATE MaterialOrders
SET `cancelledByUid` = :uid,
`cancelled` = 'true'
WHERE `idMaterialOrders` = :idMaterialOrders
");
$sCancel->bindValue(":uid", $_SESSION["uid"]);
$sCancel->bindValue(":idMaterialOrders", $_GET["oid"]);
if ($sCancel->execute()) {
$sCancel->closeCursor();
}

}

<a href="includes/orderItems.php?Cancel=true&oid=<?php print $_GET['oid']; ?>" class="supplierMaterial" target="_blank"> 
<input type="button" value="Cancel Order" name="Cancel" id="Cancel">

最佳答案

由于您要在单击链接时实现,因此只能使用 $_GET,因为要将其用作 $_POST,必须以 post 方法提交表单。请尝试这个,

<a href="includes/orderItems.php?Cancel=true&oid=<?php print $_GET['oid']; ?>" class="supplierMaterial" target="_blank"> 
<input type="button" value="Cancel Order" name="Cancel" id="Cancel">
</a>

关于单击按钮后 PHP isset 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31408855/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com