【发布时间】:2014-07-09 03:52:19
【问题描述】:
这很奇怪。当我直接打开它时,这段代码运行良好——但如果我运行它之前的网页,它就不行。这段代码是一个确认页面,我想在结帐过程中跳转-我有我的所有字段,我不需要再次要求用户确认,所以我直接将她发送到结帐,发送所有的值字段。
再次,当我从另一个表单帖子到达此页面时,它不起作用--尽管发送到此页面的其他字段或对象都没有像表单那样被调用--。有什么想法吗?
<?php include 'security.php' ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Secure Acceptance - Payment Form</title>
<link rel="stylesheet" type="text/css" href="payment.css"/>
</head>
<body>
<?php
foreach($_REQUEST as $name => $value) {
$params[$name] = $value;
}
?>
<p>Redirecting to Secure Server...</p>
<form action="https://testsecureacceptance.cybersource.com/pay" method="post" id="formulario" name="formulario" />
<?php
foreach($params as $name => $value) {
echo "<input type=\"hidden\" id=\"" . $name . "\" name=\"" . $name . "\" value=\"" . $value . "\"/>\n";
}
echo "<input type=\"hidden\" id=\"signature\" name=\"signature\" value=\"" . sign($params) . "\"/>\n";
?>
<input type="submit" id="boton" name="boton" value="Ir a Checkout >>"/>
</form>
<script type = "text/javascript">
document.getElementById('formulario').submit();
</script>
</body>
</html>
【问题讨论】:
-
尝试使用 'setTimeout(function(){ /* your code */ , 1000}',当 javascript 渲染时表单可能没有准备好
-
您的
$params是否有$name的“提交”?如果是这样,你已经劫持了 document.form.submit 函数,它不会工作。
标签: javascript php html forms form-submit