Multidimensional arrays shopping cart question
Posted: Mon Jul 07, 2003 5:05 pm
Hi there,
How can I automatically add another array to an existing one hence making it multidimensional like an add to cart script..
In my script each array has a; category, description and price like so:
as you can see the first one goes obviously goes in there fine but when the form in my script is re-submitted it overwrites the existing stuff.. how can I end up with the following:
Do I really have to use sessions?? 
How can I automatically add another array to an existing one hence making it multidimensional like an add to cart script..
In my script each array has a; category, description and price like so:
Code: Select all
//create array
$arr_prod = array(Category=>$f_cat,
Description=>$f_desc,
Price=>$f_price);Code: Select all
$arr_prod = array(
array(Category=>"shoes",
Description=>"these are shoes",
Price=>49.99),
array(Category=>"trainers",
Description=>"these are trainers",
Price=>39.99),
array(Category=>"t-shirts",
Description=>"these are t-shirts",
Price=>19.99),
);