tags:

views:

63

answers:

2

Im trying to add additional arrays into my session variable such as...

$_SESSION[cart] .= array($_POST[name],$_POST[price],$_POST[quantity]);

All i get when i do this 3 times and var_dump is string(15) "ArrayArrayArray"

A: 

You can use print_r and see the content of the array.

i.e., print_r($_SESSION)

Ngu Soon Hui
just getting ArrayArrayArray
Patrick
`Var_dump` often gives more information then `print_r`. I really don't see how or why this would be any help.
MitMaro
+3  A: 

Youre using .= "." is for string concat so youre arrays are getting converted to strings you should use one of the following:

$_SESSION['cart'][] = array($_POST[name],$_POST[price],$_POST[quantity]);

$_SESSION['cart'] += array($_POST[name],$_POST[price],$_POST[quantity]);

array_push(array($_POST[name],$_POST[price],$_POST[quantity]), (array) $_SESSION['cart'];
prodigitalson