0

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.

2
  • 3
    $_SESSION['front_door_array']['front_door_model'] Commented Feb 18, 2013 at 3:48
  • Well that was very simple, thanks @MichaelBerkowski Commented Feb 18, 2013 at 3:54

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Yeah I had thought of this but just wanted to learn if there was a way to do it through the session. Ta!
This is the way to do it through the session, $_SESSION is a global array variable, you can add as many keys as you want and then access it again from another script in the same session.
0

Try this :

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

To see all the values assigned in session :

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.