I am thing of a way to pass about 15 parameters to a url pagination:
for example I have:
$input = $_GET['input'];
$categories = $_GET['category'];
$state = $_GET['state'];
$zipcode = $_GET['zipcode'];
I could do it this way and works fine:
$paginate.= "<a href='$targetpage?page=$prev&input=".$_GET['input']."&
category=".$_GET['category']."&state=".$_GET['state']."&
zipcode=".$GET['zipcode']."'>Previous</a>";
But I have a lot more Parameters to pass. Could someone show me how it's done using an array or anything better?
Thank you
Yo can use this function:
http_build_query
php.net example:
<?php
$data = array('foo'=>'bar',
'baz'=>'boom',
'cow'=>'milk',
'php'=>'hypertext processor');
echo http_build_query($data) . "\n";
echo http_build_query($data, '', '&');
?>
Output:
foo=bar&baz=boom&cow=milk&php=hypertext+processor
foo=bar&baz=boom&cow=milk&php=hypertext+processor
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With