Today, I will teach you how to create a session array in Hypertext Preprocessor (PHP). Session Array() variable has the ability to hold multiple data at once. This will help you store various data that can be accessed in different pages.
First, you have to start the session to read all the session variable that are being declared.
Second, declare a SESSION ARRAY variable to be able to store multiple data.
Lastly is storing data in the session variable that you have declared.
- $_SESSION['cointainer']['Address']="Kabankalan City";
- $_SESSION['cointainer']['Email']="[email protected]";
- // and you can also do this one.
- //It presents the value and their curresponding keys.
- echo print_r($_SESSION['cointainer']) .'<br />;
- echo print_r($_SESSION['employee']);