0

I have an search method who redirect to something like this:

mysite.ro/search.php?a=1&b=2&c=3

When i have pagination i need to redirect me to something like this:

mysite.ro/search.php?a=1&b=2&c=3&page=2

I dont know the solution to have an href who redirect to page=2 and keep the same search criteria. I tried <a href="&page=2"> and href="<?php echo $_SERVER[REQUEST_URI];?>&page=1" not usefull both.

TheBosti
  • 1,354
  • 13
  • 19
  • A very quick Google search lead me here: http://stackoverflow.com/a/8562701/1476763 – SeanWM Jun 30 '15 at 13:32
  • Is not working... After multiple clicking i have something like this: &page=2&page=2&page=2&page=3 and counting – TheBosti Jun 30 '15 at 13:39

1 Answers1

1

Try this, Its worked for me.

<?php

 $actual_link = '';
 $delimiter = '?&page=';
 $link = array();
 $actual_link = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
 $links = explode($delimiter, $actual_link);
 ?>
 <a href="<?php echo $links[0];?>?&page=1" >Link </a>
Ankur Tiwari
  • 2,762
  • 2
  • 23
  • 40
  • Same problem, after multiple clicking i have something like this: &page=2&page=2&page=2&page=3 and counting – TheBosti Jun 30 '15 at 13:41