Hi,
I'm trying to get a grip of arrays, specifically how to store and add to a multidimensional array in a cookie.
I'm jumping in at the deep end as arrays are my weak point with php, going through the first 2 pages of google results for tutorial, examples and advice has just got me more confused than ever.
following the classic shopping cart model, i am looking to store item name, item price and quantity of that item. I am looking for the same cookie to store this information for multiple selections
eg
blue books, 5.99, 22
socks, 4.99, 5
I would put some code but I dont know where to start, any advice at this stage much appreciated .
luke cousins
as an alternative - I found this script written by some nice person, but I dont understand what is going on at all, anyone care to anootate it for me??
function additem($id, $name, $count, $prix)
{
if ($this->items[$id][1] > 0 )
{
$this->items[$id][1]+=$count;
}
else
{
$this->items[$id][0]=$name;
$this->items[$id][1]=$count;
$this->items[$id][2]=$prix;
$this->items[$id][3]=stripslashes($name);
}
setcookie("cart",serialize($this->items),0,"/");
$this->empty=false;