Why doesn't the following code work.
I'm trying to test if an array exists, to insert data into it, else create the array. Only each time I access the page, the array contains no data. Why is this?
<?php
session_start();
$id = $_GET['id'];
$array = $_SESSION['ids'];
if (!isset($array))
{
$array = array();
}
else
{
$array[] = 'Data';
$_SESSION['ids'] = $array;
}
echo $_SESSION['ids'];
print_r($array);
?>