Page 1 of 1

append associative array to session, losing assoc values...

Posted: Tue Apr 03, 2007 3:30 pm
by visitor-Q
why is it that when i add an item to my shopping cart, it loses the associative values???

Code: Select all

if(isset($_POST)){
        $_SESSION['shopping_cart'][] = $_POST;
}
here are the values of the arrays;

Code: Select all

POST ARRAY:
Array
(
    [id] => 12
    [name] => Sandwich
    [price] => 6.5
    [quantity] => 1
    [ingredients] => Array
        (
            [0] => mayonnaise
            [1] => lettuce
            [2] => tomatoes
            [3] => cheese
        )

)


SESSION ARRAY:
Array
(
    [session_id] => 299c29cfa3ed5119f8b383455de1117d
    [shopping_cart] => Array
        (
            [0] => Array
                (
                    [0] => 1
                    [1] => 6.5
                    [2] => 12
                    [3] => Sandwich
                    [4] => Array
                        (
                           [0] => mayonnaise
                           [1] => lettuce
                           [2] => tomatoes
                           [3] => cheese
                        )

                )

        )

)

Posted: Tue Apr 03, 2007 3:54 pm
by visitor-Q
i don't know what happened, or what i changed... but for some reason... it's not losing the associative values anymore... wtf...