0

这是一个电子支付提交表单(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>
4

1 回答 1

1

资本化问题。你有

<input type="hidden" name="amount" value="<?php echo $Amount; ?>" >

但是尝试通过以下方式访问它:

$input_Amount = trim($_POST["Amount"]);

您需要将您的 htmlname属性更改为"Amount" $_POST$_POST["amount"]

于 2018-06-22T01:22:22.813 回答