我当前正在执行此更改状态功能,并且我计划仅通过单击更改按钮来更改状态,将出现提示消息并且状态将被更改。但是,当我从提示中按OK时,什么也没有发生,没有数据更新,它只返回了我所在的页面。我错过了什么吗?
PHP代码:
<?php
if(isset($_GET['idd'])){
$idd = $_GET['idd'];
$query = $conn->query("SELECT * FROM orders WHERE order_id='$idd' limit 0,1");
$row = $query->fetch_assoc();
$id = $row['order_id'];
$status = 'Warehouse A';
$session = $_SESSION['username'];
$result = $conn->query("UPDATE orders(status,editor) SET status='".$status."',editor='".$session."' WHERE order_id='".$id."'");
if($result){//success update message
?>
<script>
window.location.href='orders_mid.php';
</script>
<?php
}
}
?>
html按钮代码:
<td>
<a onclick="return confirm('Are You Sure The Goods Are Delivered to Warehouse A?')"
href="?idd=<?= $rows['order_id']; ?>"
id="changeBtn"
class="btn btn-danger"> Change </a>
</td>