We can use http_build_query function to use an array and create query string using all its elements. This output is already urlencoded and output string can be used in a URL to pass data to another page.
To generate the query string let us use this example. We have created an array with data from address book. Next line we use the same array to build the query string using http_build_query() function.
$ar=array("FName"=>"John","Address"=>"Street No 11 ","City"=>"Rain Town","Country"=>"USA");
echo http_build_query($ar);