我有一系列变量,我通过Paypal传递给它。我遇到的问题是当Paypal屏幕加载项目时,数量,价格部分为空。以下是传递的代码片段: - (数组cart_stock和cart_price保存要传递的数据,$ tmp_cart_count保存要传递的项目总数)
<?php
echo "<form target='PayPal' action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post'>";
echo "<input name='cmd' value='_xclick' type='hidden' />";
echo "<input name='upload' value='1' type='hidden' />";
echo "<input name='business' value='sales@danskvintage.com.au' type='hidden' />";
// other irrelevant variables are passed here //
$i=0;$count=1;
while ($i < $tmp_cart_count)
{
echo "<input name='custom' value='".$_SESSION['cart_stock'][$i]."' type='hidden' >";
echo "<input name='item_name_".($count)."' value='".$_SESSION['cart_title'][$i]."' type='hidden' >";
echo "<input name='quantity_".($count)."' value='1' type='hidden' >";
echo "<input name='amount_".($count)."' value='".$_SESSION['cart_price'][$i]."' type='hidden' >";
echo "<input name='shipping_".($count)."' value='0' type='hidden' >";
$i++;
$count++;
}
echo "<input type='submit' value='PayPal'>";
echo "</form>";
?>
任何帮助都会非常感激,因为它让我感到难过。
答案 0 :(得分:2)
尝试更改
echo "<input name='cmd' value='_xclick' type='hidden' />";
进入
echo "<input name='cmd' value='_cart' type='hidden' />";
我相信这可能会有所帮助。