Have tried a number of permutations to get a value from a PHP session. The session is an array of objects I think with key value pairs. This is the structure as outputted by a key/value foreach loop
Array
(
[laboratory_roster] => Array
(
[employee_entrance] => stdClass Object
(
[step] => employee_entrance
[employee_first_name] => asdfasd
[employee_last_name] => fasdfasdfv
[employee_access_code] => valid
[employee_email] => [email protected]
[employee_state_origin] => NY
[employee_kit_for_whom] => employee_kit_for_employee
)
)
)
This is the foreach loop that I wrote to display the output above:
foreach($_SESSION['laboratory_roster']['employee_entrance'] as $key=>$value)
{
// and print out the values
echo 'The value of $_SESSION['."'".$key."'".'] is '."'".$value."'".' <br />';
}
What I wish to do is simply assign the value of the innermost value to a variable. Nothing works. Have tried:
$first_name = $_SESSION['employee_entrance']['employee_first_name'];
and this...
$first_name = $_SESSION['employee_entrance'][1];
and this...
$first_name = $_SESSION['laboratory_roster']['employee_entrance']['employee_first_name'];
and this...
$first_name = $_SESSION['laboratory_roster']['employee_entrance']['employee_first_name'][0];
Nothing works! It's probably so simple how to get the innermost value into a PHP variable, but I am not getting it. Thanks for help!