Header menu

_________________________________________________________________________________

Wednesday, 21 August 2013

How to send an array in url in php ?

File.php  (This file contain array )

<?php

$data = array('foo'=>'bar',
              'baz'=>'boom',
              'cow'=>'milk',
              'php'=>'script');

$arr=http_build_query($data);

?>
<a href="nextpage.php?<?php echo $arr; ?>">Sendarray</a>


--------------------------------------------------------------------------------------------------------------------------------

nextpage.php (This file will receive array and print it)


<?php
echo "<pre>";
print_r($_GET);
echo "</pre>";
?>