Im making a shopping cart object, which holds the contents of the cart in a mutlidimensional, associative array. Im ok with sessions, but not too hot on objects, which is probably where the problem lies. heres the bit of the code im interested in...
function add_item($item){
//$item is associative array
//$n= next slot in the array. when added to cart, register session data
$n=count($this->contents);
$this->contents[$n]['id']=$item['id'];
$this->contents[$n]['name']=$item['name'];
$this->contents[$n]['quantity']=$item['quantity'];
$this->contents[$n]['price']=$item['price'];
$this->contents[$n]['description']=$item['description'];
$this->contents[$n]['total_price']=$item['total_price'];
$session_data=$this->contents;
session_register("session_data");
}
I thought that would register the contents array into the session, but when i try to access this array on the next page, after starting the session, its not there.
Oh, and there IS a call to session_start() before that code.. so thats not the problem...
thanks for any help....
Rich x