Passing an array through GET request


/ Published in: PHP



Copy this code and paste it in your HTML
  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. ?>

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.