I am working on the following code in file1
$_SESSION['manu']="hello";
$_SESSION[0]=$msg;
$_SESSION[1]=$msg1;
for($arr=0;$arr<sizeof($msg2);$arr++)
$_SESSION[$arr+2]=$msg2[$arr];
$_SESSION[++$arr]=$msg3;
$_SESSION[++$arr]=$file_name;
In file 2
echo sizeof($_SESSION);
for($arr=0;$arr<sizeof($_SESSION);$arr++)
echo $_SESSION[$arr];
echo $_SESSION['manu'];
However the sizeof session comes out to be 1 in file2 and all my session values stored in offset forms are lost?
The names of the elements in the
$_SESSIONarray are subject to the same limitations as normal PHP variables: they cannot start with a number and must start with a letter or underscore.So, using numbers as a session element is not allowed. That is why you lose them in the transition.
(If you had error reporting turned on you would have gotten an error notice.)
Rather than do:
Try: