延迟将开机自检请求重定向到另一个页面


Delayed redirected POST request to another page

我在重定向到其他页面时发现错误。 这是我的代码:

付款方式.php:

<form action="payment2.php" method="post">
<input type="hidden" name="amount" value="<?php echo $payable; ?>" />
<input type="hidden" name="confirm" value="<?php echo $confirmation; ?>" />

付款方式2.php:

header("Refresh: 2;url=paymentGate.php"); 
$pay=$_POST['amount1'];
$confirmation=$_POST['confirm1'];
<html>
    <head>
        <title>Redirects</title>
        <meta http-equiv="refresh" content="2; URL=paymentGate.php" />
        <script type="text/javascript">
                    window.setTimeout(function() {
                        location.href = 'paymentGate.php';
                    }, 2000);
        </script>
          <input  type="hidden" name="amount1" value="<?php echo $pay; ?>" />
        <input   type="hidden" name="confirm1" value="<?php echo $confirmation; ?>" />
    </head>
    <body>

支付闸机.php:

$pay=$_POST['amount1'];
$confirmation=$_POST['confirm1'];
echo <?php $pay ?>
echo <?php $confirmation ?>

金额 1 和 confirm1 是支付门中的未定义索引.PHP.如何解决这个问题?

重定向不会神奇地重新提交表单。请尝试以下操作:

<form action="paymentGate.php" method="post" id="myForm">
     <input type="hidden" name="amount1" value="<?php echo $pay; ?>" />
     <input type="hidden" name="confirm1" value="<?php echo $confirmation; ?>" />
</form>
<script>
   setTimeout(function() { document.getElementById('myForm').submit() }, 2000);
</script>

这将在 2 秒内自动提交"伪造"表单。

2 秒后发布表单。这样就可以了。

$pay=$_POST['amount1'];
$confirmation=$_POST['confirm1'];
<html>
    <head>
        <title>Redirects</title>
        <script type="text/javascript">
                    window.setTimeout(function() {
                        document.form1.submit();
                    }, 2000);
        </script>
</head>
    <body>
<form method="post" action="paymentGate.php" name="form1" id="form1">
          <input  type="hidden" name="amount1" value="<?php echo $pay; ?>" />
        <input   type="hidden" name="confirm1" value="<?php echo $confirmation; ?>" />
</form> 
</body>
</html>

你不能用帖子数据重定向,你应该尝试得到menthod

 window.location = '/paymentGate.php?amount1='+amount1&confirm1='+confirm1;
$pay=$_POST['amount1'];
$confirmation=$_POST['confirm1'];
sleep(5) //5 seconds
echo <?php $pay ?>
echo <?php $confirmation ?>