user1871245
user1871245

Reputation:

Accessing an Array variable through a session

I have an array stored in a session like so

            $front_door_array = Array (
                                        "front_door_model" => $_SESSION['front_door'],
                                        "front_door_qty"   => $_SESSION['front_qty']
                                      );

            $_SESSION['front_door_array'] = $front_door_array;

I now need to access front_door_model and front_door_qty on another page through the session but am unsure how to. Normally I'd just do something like $front_door_array['front_door_qty']; but I don't know how to do this through the session.

Upvotes: 0

Views: 30

Answers (2)

Prasanth Bendra
Prasanth Bendra

Reputation: 32710

Try this :

$_SESSION['front_door_array']['front_door_model']

To see all the values assigned in session :

echo "<pre>";
print_r($_SESSION);

Upvotes: 0

martriay
martriay

Reputation: 5742

Just use the $_SESSION['front_door_array'] variable :)

Upvotes: 1

Related Questions