Hello
I want to store whole array in the session. Is it possible to store an array in the session? Please send me an example for it.
Thanks
Hello
I want to store whole array in the session. Is it possible to store an array in the session? Please send me an example for it.
Thanks
U mean to store array in session means u want to store all values ranging username password n all in a array at run time in the current working session?
Yes we can store an array into session.
suppose TEMP is an array.
To put array into session: Session["array"]=TEMP;
and to retrive the array in another page: ArrayList temp=(System.Collections.ArrayList)Session["array"];
I hope this will help u.
E.G.
$a = array('a','b','c');
$_SESSION['ab'] = $a;
this session var is array.
to access this session var, print_r this variable
print_r($_SESSION['ab']);
You can store array in the session as a normal variables. you can use $_SESSION['ar'] = arrayname
store
retriveCode:$ar = array(1,2,3); $_SESSION['sesarr']=$ar;
Code:$a=$_SESSION['sesarr']; print_r($a);
Bookmarks