我有一个 displaycart.php
页面,其中显示我在购物车中的所有商品,每个商品都有一个 ItemUnitPrice
字段,其中显示商品的单价 .
如果我在购物车中说了6个项目,那么我想将总计 ItemUnitPrice
个字段加起来并设置要用PayPal支付的金额 .
我已经检查了他们允许的PayPals按钮功能,您只能为用户设置给定的价格,以便在创建按钮时付费 .
有没有办法将PayPal按钮链接到我的数据库,以便显示所有 ItemUnitPrice
字段的总和 .
保存总数 ItemUnitPrice
的变量:
<?php
$Total = $Quantity * $ItemUnitPrice;
?>
PayPal'立即付款'按钮:
<html>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="KAMQ5PVWVDYYN">
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_paynow_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
</html>
Edit:
是的,我做了一些愚蠢的错误!
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_BLANK">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="info@asianweddingservices.org" />
<input type="hidden" name="item_name" value="<? $ItemDesc ?>" />
<input type="hidden" name="item_number" value="<?$ItemCode ?>" />
<input type="hidden" name="amount" value="<?$Total ?>" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="lc" value="GB" />
<input type="hidden" name="bn" value="PP-BuyNowBF" />
<input src="paypal/purchase.png" name="Submit" type="image" value="purchase" alt="Purchase" />
</form>
1 回答
是 . 将设定值更改为总计 .
显示您的代码,我可以编辑答案来为您修复它 .
Add this:
If that doesn't work:
当然,将值替换为您的值 .