Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 829597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:54:33+00:00 2026-05-15T03:54:33+00:00

The problem is that when I load page 2 for example the URL becomes:

  • 0

The problem is that when I load page 2 for example the URL becomes:

http://domain.com/index.php?restaurant-id=45&currentpage=2

And that’s fine but when I get to page 3 it becomes:

http://domain.com/index.php?restaurant-id=45&currentpage=2&currentpage=3

And so on, it adds one more currentpage parameter everytime a new page is loaded from the pagination links!

I wonder how this problem can be fixed?

Here’s some of the pagination function’s code

 /******  build the pagination links ******/
// Getting current page URL with its parameters
$current_page_url = ($_SERVER["PHP_SELF"].(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));
// Determine which sign to use (? or &) before the (currentpage=xx) parameter
$sign = preg_match('/\?/', $current_page_url) ? '&' : '?';

$pagination_links = '';
// if not on page 1, don't show back links
if ($currentpage > 1) {
   // show << link to go back to page 1
   $pagination_links .= " <a href='{$current_page_url}{$sign}currentpage=1'>First page</a> ";
   // get previous page num
   $prevpage = $currentpage - 1;
   // show < link to go back 1 page
   $pagination_links .= " <a href='{$current_page_url}{$sign}currentpage=$prevpage'>previous</a> ";
}
else
{
    $pagination_links .= "ـ ـ"; 
}// end if 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:54:34+00:00Added an answer on May 15, 2026 at 3:54 am

    You could remove currentpage parameter from $current_page_url variable with regex although it’s ugly.

    $current_page_url = preg_replace('currentpage=\d+', '', $current_page_url);
    

    However I’d suggest writing a small function that will generate URLs on the values you pass to it and then you can easily modify any parameter without having to worry about regexes and removing them from the URL. Something like this should be fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I use a pagination system that requires url like http://mypage.com/index.php?page=1 http://mypage.com/index.php?page=2 http://mypage.com/index.php?page=3
I have a page which is www.example.com/page_name.php?var1=dynamic_var1&var2=dynamic_var2 I want to use .htaccess file to
I'm trying to load a page using the load() function, the problem is that
Let's say I have a URL: http://example.com/person/list This website will display a list of
I have an ajax script, in the main index.php page, that fetches data from
I'm passing a URL variable to a PHP page that is outputting an XML
There was this problem that has been asked about implementing a load byte into
I have a really silly problem that has cost me a load of time
Here is my code: $('#right').load('textes.html #nicolas'); $('#right').load('textes.html #antoine'); The problem is that the content
I have the following scenario jQuery('#content').fadeOut('slow',function(){ jQuery('#content').load(detail.php?product=+imgID+&category=+cat); jQuery('#content').fadeIn('fast'); }); My problem however is that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.