-3

I have multiple values so i want to send them in query string. I have found a solution from stackoverflow but it does not working properly. Can any on guide me where i'm wrong.

URL

www.xyz.com/action=exe?check_ids[]=38&check_ids[]=36&check_ids[]=35

Getting Values from Url

echo $_REQUEST['check_ids'];
Ayaz Ali Shah
  • 634
  • 2
  • 7
  • 16

2 Answers2

2

For url like www.xyz.com/action?check_ids[]=38&check_ids[]=36&check_ids[]=35 you can do this :

echo $_REQUEST['check_ids'][0]; //print 38
echo $_REQUEST['check_ids'][1]; //print 36

OR use this

foreach($_REQUEST['check_ids'] as $id)
        echo $id;//this will print the individual values
Amit.S
  • 431
  • 2
  • 9
0

There are several ways you can do it by using commas:

http://www.example.com/?action=exe&check_ids=38,36,35

// to get an array use explode
var_dump(explode(",", $_GET['check_ids']);
michelem
  • 14,430
  • 5
  • 50
  • 66