在我的本地计算机上,当我提交此表单时,我确实在$_SESSION['cart']
内有项目,沙箱会识别其中的项目。但是当我在实时服务器上尝试它时,我在$_SESSION['cart']
内有一个项目时提交了表单,沙箱说我的购物车是空的......为什么会这样?
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" <?php if(empty($_SESSION['cart'])){echo "onsubmit=\"return false;\"";} ?>>
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="business" value="<?=$ppemail['email']?>" />
<?php
$i = 1;
foreach($_SESSION['cart'] as $id => $qty):
$product = $myCart->getProduct($id);
?>
<input type="hidden" name="item_name_<?php echo $i; ?>" value="<?php echo $product['ProductName']; ?>">
<input type="hidden" name="item_number_<?php echo $i; ?>" value="<?php echo $product['ProductID']; ?>">
<input type="hidden" name="amount_<?php echo $i; ?>" value="<?php echo $product['ProductOverridePrice']; ?>">
<input type="hidden" name="quantity_<?php echo $i; ?>" value="<?php echo $qty; ?>">
<?php
$i++;
endforeach;
?>
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="shipping_1" value="<?php echo $shipping; ?>">
<input type="hidden" name="return" value="<?php echo $the_class->settings[0]['DomainName'];?>shopping-cart-details.php">
<input type="hidden" name="cancel_return" value="<?php echo $the_class->settings[0]['DomainName'];?>">
<input type="hidden" name="notify_url" value="<?php echo $the_class->settings[0]['DomainName'];?>classes/paypal.php">
<input type="image" src="images/continue-btn.png" name="pay now" value="pay" />
</form>
答案 0 :(得分:0)
我发现了这个错误......现场服务器上的表......我的意思是,其中一个字段名称是小型的帽子.errr