我正在为电子商务实践网站使用PayPal按钮脚本。 PayPal代码是一个HTML表单,我在PHP中回应。我需要从输入的表单中获取值以用于更新数据库。如何从提交表单中获取PHP中的金额,数量和价值表单字段?
PayPal表格
$paypalButton = '<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="amount" value=' .$value .'>
<div class="form-group row col-xs-3 col-md-2">
<label class="control-label" for="usr">Quantity</label>
<input type="number" class="form-control"
name="quantity" value=' .$quantity .' min="1" max="10">
</div>
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value=' .$paymentId .'>
<input type="hidden" name="item_name" value=' .$itemName .'>
<input type="hidden" name="currency_code" value=GBP>
<input type="hidden" name="UseSandbox" value="true">
<input type="hidden" name="return" value=' .$returnURL .'>
<input type="hidden" name="cancel_return" value=' .$cancelURL .'>
<div class="form-group row col-xs-12 col-md-12">
<label class="control-label" for="usr"></label>
<input type="image" align="centre" src="http://www.paypal.com/en_AU/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - its fast, free and secure!">
</div>
</form>';
答案 0 :(得分:0)
你应该做
$variable = $_POST["anotherVar"];
示例:
$paymentID = $_POST["paymentId"];