Reputation: 53
I have following code to pass values through URL:
<a href="menu_food_categories.php?value=1"><img src="images/veg.png" width="100%"></a>
<a href="menu_food_categories.php?value=2"><img src="images/Non-veg.png" width="100%"></a>
<a href="menu_food_categories.php?value=3"><img src="images/combined.png" width="100%"></a>
<a href="menu_food_categories.php?value=4"><img src="images/beverages.png" width="100%"></a>
Now I want to pass value 1 and 2 along with value 3, anyone can help please.
Upvotes: 1
Views: 45
Reputation: 146
<a href="test.php?value1=1&value2=2&value3=3">test</a>
<?php
print_r($_GET);
// Output : Array ( [value1] => 1 [value2] => 2 [value3] => 3 )
?>
Upvotes: 1
Reputation: 631
Add comma separated values in url
<a href="menu_food_categories.php?value=1,2,3">
And Then use explode function(i.e explode(',',$_GET['value'])
) to get it in array on "menu_food_categories.php" file.
Upvotes: 0
Reputation: 625
You simply can concatenate the parameters using an ampersand (&)
it would look like this
menu_food_categories.php?value1=1&value2=2&value3=3
Upvotes: 0