Passing an array through GET request

Here are two options for passing an array via GET parameters (in a url):

<A href="example.html?arr[]=val1&arr[]=val2&arr[]=val3">test</A>

<A href="example.html?arr=<?PHP echo serialize($arr); ?>">test</A>

In the first example, you can use $_GET["arr"] as an array.
In the second you will first have to:

<?PHP
$arr = unserialize($_GET["arr"]);
?>

source

Leave a Reply