Posted By

johnself on 01/02/08


Tagged

get url array


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

kdaviesnz
sekihin
jli


Passing an array through GET request


 / Published in: PHP
 

URL: http://www.webmasterworld.com/forum88/5808.htm

  1. Here are two options for passing an array via GET parameters (in a url):
  2.  
  3. <A href="example.html?arr[]=val1&arr[]=val2&arr[]=val3">test</A>
  4.  
  5. <A href="example.html?arr=<?PHP echo serialize($arr); ?>">test</A>
  6.  
  7. In the first example, you can use $_GET["arr"] as an array.
  8. In the second you will first have to:
  9.  
  10. <?PHP
  11. $arr = unserialize($_GET["arr"]);
  12. ?>

Report this snippet  

You need to login to post a comment.