I'm building a shopping cart for a school assignment. I'm pretty much there except for adding the items to the cart variable. 

I've set up my cart session with: `$_SESSION['temp_session'] = array();`

and then, when a item is added to the cart, this code is executed

```
if (isset($_POST['addtocart'])) {
            $item_name = $_POST['item_name'];
            $price = $_POST['price'];
            $qty = $_POST['qty'];

            $newItem = $item_name.":".$price.":".$qty;
            //echo $newItem;

            if (isset($_SESSION['shop_session'])) {
                array_push($shop_session, $newItem);
                //header('Location: cart.php');
                print_r($shop_session);
            }
            else {
                array_push($temp_session, $newItem);
                //header('Location: login.php?notLoggedIn=true');
                print_r($temp_session);
            }
        }

```

it all seem s to be working fine (i can print out `$newItem` and it contains the elements) but when I try to add `$newItem` to either `$shop_session` or `$temp_session` and then print them out, there array is empty. 

Is this something to do with the way I'm using `array_push()` ?

Thanks