【发布时间】:2026-01-12 15:50:01
【问题描述】:
这是一个电子支付提交表单 (HTML+PHP)。它显示了一个获取 $Amount 的字段。
此表格 ($amount) 将发布到电子支付网站。我尝试将$Amount 传递给
<input type="hidden" name="amount" value="<?php echo $Amount; ?>" > .(<input type="hidden" name="amount" value="3000.0" > 时有效。)
错误:
HTTP 状态 404 - /b2cDemo/eng/payment/null
输入状态报告
消息 /b2cDemo/eng/payment/null
说明请求的资源不可用。
这里有什么问题吗?
其次,可以在我的源代码(HTML)中显示这些商家信息吗?有什么安全问题吗?
<input type="hidden" name="merchantId" value="13213123">
<input type="hidden" name="amount" value="<?php echo $Amount; ?>" >
<input type="hidden" name="orderRef" value="12313221">
<input type="hidden" name="currCode" value="3213123" >
......
// Define variables and initialize with empty values
$Amount = "";
$Amount_err ="";
if ($_SERVER["REQUEST_METHOD"] == "POST") {...
// Validate Amount
$input_Amount = trim($_POST["Amount"]);
if (empty($input_Amount)) {
$Amount_err = "Please enter the amount.";
} elseif (!ctype_digit($input_Amount)) {
$Amount_err = 'Please enter a positive integer value.';
} else {
$Amount = $input_Amount;
}
.....
<form name="Epayment" method="post" action=" a EPayment sites">
<input type="hidden" name="merchantId" value="....">//fixed code
<input type="hidden" name="amount" value="<?php echo $Amount; ?>" >
<input type="hidden" name="orderRef" value="...">
<input type="hidden" name="currCode" value="..." >
......
<div class="form-group <?php echo (!empty($Amount_err)) ? 'has-error' : ''; ?>">
<label>Amount</label>
<input list="Amount" name="Amount" multiple class="form-control">
<datalist id="Amount" >
<option value="100">
<option value="300">
<option value="500">
<option value="1000">
</datalist>
<span class="help-block"><?php echo $Amount_err; ?></span>
</div>
【问题讨论】:
-
您不需要显示任何东西,只要金额,一旦您提出请求,然后只需在请求中添加商家 ID 和其他所有内容
-
你的意思是我不需要写那些隐藏的输入,除了 $amount ?但现在我无法将 $amount 传递给网站
-
在您的表单中只需获取用户输入,请求 POST 到电子支付网关,只需简单地卷曲它,通过在表单中显示它(通过隐藏的输入标签)当然是商家它和东西只需检查元素即可看到
-
是的,我正在这样做。但是在我提交表单后,它显示
Error: HTTP Status 404 - /b2cDemo/eng/payment/null type Status report message /b2cDemo/eng/payment/null description The requested resource is not available.我猜$amount 无法传递到电子支付网关。 -
你的表单只是乱码,
amount不用添加隐藏输入,输入列表金额就够了,步骤如下,用户输入金额,提交表单,获取金额输入,准备商家 ID orderref 和其他所有内容,向支付网关创建一个 curl 请求(我更喜欢这个),包括敏感内容和金额。利润
标签: php html hidden-field payment-processing website-payment-pro