Possible Duplicate:
How to pass an array via $_GET in php?
So I have a script which receives a $_POST with var Board[] containing an array of IDs.
I realized when adding ShareThis to the pages that folks wanting to share the result set would send an invalid link.
I definitely can add a delimited parameter to the script so ShareThis can pass
http://foo.com/bar.php?DelimitedBoard=3|4|5.
My question is whether there is a way to do this using the current Board[] var?
http://foo.com/bar.php?Board[]=3,4,5 fails. Is there a way?
Sure, just do:
http://foo.com/bar.php?Board[]=3&Board[]=4&Board[]=5
Number array serialization is very easy. Use join(',', $Board)
to form a comma-separated ID string, use explode(',', $_GET["Board"])
to get the array back.
What you want to do is something like this:
http://foo.com/bar.php?Board[]=3&Board[]=4&Board[]=5
Then, if you print_r($_GET['Board']);
in bar.php
, you will get something like:
Array (
[0] => 3
[1] => 4
[2] => 5
)