0
我有一个变量的数组,我传递给贝宝通过。我遇到的问题是,当贝宝屏幕加载项目,数量,价格部分是空的。下面是合格的代码片段: - (阵列cart_stock和cart_price保持数据传递,$ tmp_cart_count持有的总项目数传)php传递数组到PayPal
<?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='[email protected]' 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>";
?>
任何帮助将不胜感激,因为它有我难倒。
'$ _SESSION ['cart_price'] [$ i]'包含任何东西吗? –
尝试修改'
变量是活的。数组的print_r显示它已填充。我在while循环里面也有下面的代码.//// err chk echo“item_name _”。($ count)。“is:”。$ _ SESSION ['cart_title'] [$ i]。“”; echo“quantity _”。($ count)。“is:1”; echo“amount _”。($ count)。“is:”。$ _ SESSION ['cart_price'] [$ i]。“”; –