我正在使用此表单将值传递给PayPal付款。
<form style="padding: 20px; border: 2px solid #f00; background: #fff; box-shadow: 10px 10px 20px -5px #000; border-radius: 10px; font-size:15px;" action="https://www.paypal.com/cgi-bin/webscr" method="POST">
<div class="form-row">
<div class="form-group col-md-12 mx-auto text-center">
<h3 class="text-uppercase">Please Confirm Your Payment</h3>
</div>
</div>
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="paypaltestgmail.com">
<input type="hidden" name="quantity" value="1">
<div class="form-row">
<div class="form-group col-md-4">
<label for="fullName">Full Name</label>
<input type="text" class="form-control" id="fullName" value="<?php echo $firstName . ' ' . $lastName; ?>" name="fullName" disabled="disabled">
</div>
<div class="form-group col-md-4">
<label for="email">Email</label>
<input type="text" class="form-control" id="email" value="<?php echo $email; ?>" name="email" disabled="disabled">
</div>
<div class="form-group col-md-4">
<label for="age">Age</label>
<input type="text" class="form-control" id="age" value="<?php echo $age; ?>" name="age" disabled="disabled">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="sessionType">Session Type</label>
<input type="text" class="form-control" id="sessionType" value="<?php echo $sessionType; ?>" name="item_name" disabled="disabled">
</div>
<div class="form-group col-md-4">
<label for="sessionDays">Session Days</label>
<textarea class="form-control" id="sessionDays name="sessionDays" disabled="disabled"><?php echo $sessionDays; ?></textarea>
</div>
<div class="form-group col-md-4">
<label for="sessionTime">Session Time</label>
<textarea class="form-control" id="sessionTime" name="sessionTime" disabled="disabled"><?php echo implode(', ', $_POST['sessionTime']); ?></textarea>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="totalCost">Total Cost</label>
<input type="text" class="form-control" id="totalCost" value="<?php echo $totalCost; ?>" name="totalCost" disabled="disabled">
</div>
<div class="form-group col-md-4">
<label for="totalTax">Tax Amount</label>
<input type="text" class="form-control" id="totalTax" value="<?php echo $totalTax; ?>" name="totalTax" disabled="disabled">
</div>
<div class="form-group col-md-4">
<label for="grandTotal">Grand Total</label>
<input type="text" class="form-control" id="grandTotal" value="<?php echo $grandTotal; ?>" name="amount" disabled="disabled">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<!-- <input type="hidden" name="bn" value="BuyNow"> -->
<input type="hidden" name="return" value="http://www.example.net/payment-success/">
</div>
</div>
<button type="submit" class="btn btn-primary btn-lg d-block mx-auto text-uppercase">Confirm & Pay</button>
我得到了这个结果:
我正在获得数量但没有获得$ sessionType;在description字段和$ grandTotal中;每件商品的价格(总)字段。我是第一次这样做。我的形式有什么错误?我无法解决问题。
答案 0 :(得分:1)
使用readonly属性的魔力:
此属性表示用户无法修改该值 控制。属性的值无关紧要。如果你需要 读写访问输入值,不要添加“只读” 属性。如果隐藏了type属性的值,则忽略它, 范围,颜色,复选框,收音机,文件或按钮类型(如按钮 或提交)。