HTML Help
HTML Help

Reputation: 1

I keep getting the shopping cart is empty....?

Where am I going wrong? the company email is correct I tried using the merchant Id but still no joy.....??

<?php $items = unserialize($_SESSION['items']); ?>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> 
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="no_note" value="1">  
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="return" value="http://www.cherished4ever.com/">   

<?php
$suffix = 1;
foreach($items as $item):
?>
<input type="hidden" name="item_name_<?php echo $suffix; ?>" value="<?php echo $item['name']; ?>"> 
<input type="hidden" name="amount_<?php echo $suffix; ?>" value="<?php echo      $item['price']; ?>"> 
<?php
$suffix++;
endforeach;
?>

Ok so i have got it working now however I just need some help with the checkout page showing the option name and not the item_name value set as the hidden output:

<select name="amount" style="width:150px;font:9px;margin-top:4px">
<option value="35.00">10 x 10</option>
<option value="55.00">20 x 20</option>
<option value="75.00">30 x 30</option>
</select><br>

Upvotes: 0

Views: 82

Answers (1)

Adam Plocher
Adam Plocher

Reputation: 14233

Be sure to remember your session_start(); at the top of each page that uses the $_SESSION variable.

For more information, take a look at: http://www.php.net/session_start

Upvotes: 0

Related Questions