Adding elements to array question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey again all, right I've tried using an associative array for my shopping
cart and I've encountered two problems - so far.  The first problem is that
I can't only add one item to the cart and the second problem is that when
viewing the cart it shows two items in it.  I think this is because there
are two parts to the array, "buy" and "quantity" and when I'm counting the
amount of items in the array its counting all the components of the array.

How can I add items to the end of this associative array?  Some of the code
I'm using is below.  I'm also thinking that if the below code works then
there is something wrong with the way I'm reading back the items in the
cart.  Ugh I dunno!

Any ideas?



Cheers,

Graeme :)



<?PHP

session_start();

session_name('shoppingcart');

if($buy != "")

{




$shoppingcart = array( 'buy'=>'$buy', 'quantity'=>'$quantity' );




session_register('shoppingcart');



}






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux