How can I pass one or more variables of type array to another page via $_GET?
I always passed variable values in the form ?a=1&b=2&c=3
W
$city_names = array(
'delhi',
'mumbai',
'kolkata',
'chennai'
);
$city_query = http_build_query(array('city' => $city_names));
this will give you:
city[0]=delhi&city[1]=mumbai&city[2]=kolkata&city[3]=chennai
if you want to encode the brackets also then use the below code:
$city_query = urlencode(http_build_query(array('city' => $city_names)));
Output:
city%255B0%255D%3Ddelhi%26city%255B1%255D%3Dmumbai .....
Reference: http_build_query, urlencode