【发布时间】:2021-11-12 07:04:38
【问题描述】:
This is the index page,用户从那里被重定向到付款页面。付款完成后,我希望用户被重定向到成功页面,该页面最终重定向到已付款的“特定”项目的详细信息页面。 $customer['id'] 是一个整数值,决定了项目的唯一 id,所以如果我们可以将用户重定向到 details.php?id=$customer['id'] 就完成了。但是,我似乎无法设法找到这样做的方法。 这是我试图修改 $customer['id'] 的索引部分,以便可以通过付款页面轻松地将其传递到详细信息页面:
<?php
$newID = ($customer['id']);
?>
<div class="card-action right-align">
<a class="brand-text" href="payment.php">more info</a>
</div>`
这是应该重定向到的成功页面代码:
<?php
include 'index.php';
if(!empty($_GET['tid'] && !empty($_GET['product']))) {
$GET = filter_var_array($_GET, FILTER_SANITIZE_STRING);
$tid = $GET['tid'];
$product = $GET['product'];
} else {
header('Location: payment.php');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<title>Thank You</title>
</head>
<body>
<div class="container mt-4">
<h2>Thank you for purchasing <?php echo $product; ?></h2>
<hr>
<p>Your transaction ID is <?php echo $tid; ?></p>
<p>Check your email for more info</p>
<?php header('Refresh: 2; URL=details.php?id=$customer['id']');?>
</div>
</body>
</html>
在上面的代码中,这是最重要的部分(我猜必须以某种方式修改才能使其工作):
<?php header('Refresh: 2; URL=details.php?id=$customer['id']');?>
有人可以帮帮我吗?
【问题讨论】:
-
不推荐使用常量FILTER_SANITIZE_STRING。请停止使用。
标签: php html sql stripe-payments