Hi all, i have a multidimentional array i want to pass as a session variable.
Of course i serialized the array.
I have 2 files, set.php & get.php
set.php populates the array, and get.php prints it out. below is my code:
Set.php:
<?php
session_start();
$array = $_SESSION['array'];
if ($array) {
$associative = unserialize($array);
print "Array Exists <br />";
} else {
$associative = array();
print "Array Created <br />";
}
$associative[0] = array();
$associative[1] = array();
$associative[2] = array();
$associative[0][0] = "0-0";
$associative[0][1] = "0-1";
$associative[1][0] = "1-0";
$associative[1][1] = "1-1";
$associative[2][0] = "2-0";
$associative[2][1] = "2-1";
$_SESSION['array'] = serialize($array)
?>
Get.php:
<?php
session_start();
$array = $_SESSION['array'];
if ($array) {
$associative = unserialize($array);
print "Array Exists <br />";
} else {
$associative = array();
print "Array Created <br />";
}
for ($i = 0; $i < count ($associative); $i++){
print "Associative array: ".$associative[$i];
print "Subarray1: ".$associative[$i][0];
print "Subarray2: ".$associative[$i][1];
}
?>
So i navigate to set.php, then to get.php but nothing prints....
What am i doint wrong?