PHP program to pass data as GET parameters
<?php // PHP 5 how to pass data as a query string /* http_build_query is a function in PHP 5 that enables you to URL encode the query string. You can pass an array or an array of array to this function. The default separator is "&" */ $data = array("first_name" => "Robert", "last_name" => "Brown", "address" => "123 Adam St., New York" ); // URI formatted with character encoding $pass_string = "http://localhost/demo.php?".http_build_query($data, ''); echo "<h2>Query URI (using http_build_query)</h2><br />"; echo $pass_string; ?>
Ouput from the above execution:
Query URI (using http_build_query)
http://localhost/demo.php?first_name=Robert&last_name=Brown&address=123+Adam+St.%2C+New+York