The reason why isbecuase you are not making them arrays. Why you add an item use this method:
PHP Code:
<?php
function add_item($new_itemid, $new_qty)
{
$_SESSION['itemid'][] = $new_itemid;
$_SESSION['qty'][] = $new_qty;
}
?>
I would suggest you change your approach and have an array of item objects like this:
PHP Code:
class Item
{
var $id;
var $price;
var $qty;
function Item($id, $price, $qty)
{
$this->id = $id;
$this->price = $price;
$this->qty = $qty;
}
}
function add_item(& $item)
{
$_SESSION['cart_items'][] = & $item;
}
/* example */
$item = new Item('Mars Bar', 0.55, 2);
add_item($item);