Hello all,
I want to pass the array from one php page to other php page. So how to make array as an session variable.
with regards
Hi kumuda v
I think you can simply do the following
Starting Page
[php]
<?php
session_start() ;
// assuming array is defined as $laArray for simplicity
$_SESSION['my_array'] = $laArray ;
?>
[/php]
Target page:
[php]
<?php
session_start ;
$laArray = $_SESSION['my_array'] ;
// you can now use $laArray in whatever wway you wnat
// write it back to the $_SESSION
$_SESSION['my_array'] = $laArray ;
?>
[/php]
This should do the trick for you. I'm not sure if it is possible to manipulate the array within the $_SESSION array - it should be, but I would find that confusing so I would always extract it first for clarity in code.
I have not tried this idea but I think it should work. Have a go and ost back with any problems - be sure to load code into code tags.
Cheers
nathj