Call this code mypage2.php
<?phpAll of the values are stored in the $_SESSION array, which we access here. Another way to show this is to simply run this code:
// this starts the session
session_start();
// echo variable from the session, we set this on our other page
echo "Our color value is ".$_SESSION['color'];
echo "Our size value is ".$_SESSION['size'];
echo "Our shape value is ".$_SESSION['shape'];
?>
<?phpYou can also store an array within the session array. Let's go back to our mypage.php file and edit it slightly to do this:
session_start();
Print_r ($_SESSION);
?>
<?phpNow let's run this on mypage2.php to show our new information:
session_start();
// makes an array
$colors=array('red', 'yellow', 'blue');
// adds it to our session
$_SESSION['color']=$colors;
$_SESSION['size']='small';
$_SESSION['shape']='round';
print "Done";
?>
<?php
session_start();
Print_r ($_SESSION);
echo "<p>";
//echo a single entry from the array
echo $_SESSION['color'][2];
?>

