I wish to pass an array through url. I checked at passing arrays as url parameter. Isnt there any other way? Below is my code
$result=Users.LoggedInUsers();
header('Location: http://localhost/Campus/Users.php?id='.$result.'');
I wish to pass an array through url. I checked at passing arrays as url parameter. Isnt there any other way? Below is my code
$result=Users.LoggedInUsers();
header('Location: http://localhost/Campus/Users.php?id='.$result.'');
Check out http_build_query
<?php
$arr = array(1,2,3,4);
echo http_build_query(array('arr'=>$arr));
//arr%5B0%5D=1&arr%5B1%5D=2&arr%5B2%5D=3&arr%5B3%5D=4
You can serialize
it easily, then unserialize it to get it back to an array:
$result=serialize(Users.LoggedInUsers());
header('Location: http://localhost/Campus/Users.php?id='.$result.'');