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 8065057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:33:11+00:00 2026-06-05T11:33:11+00:00

I use GET for pagination, ?page=1 is page one and so on. The problem

  • 0

I use GET for pagination, ?page=1 is page one and so on.

The problem is, is that I would like to sort the data and using GET is the better way of doing it, as so:

?page=1&sort=date

If I try that and click page 2, it will go to ?page=2 and loose the sorting.

I have also tried $_SERVER['QUERY_STRING'] but I just end up with an accumulation of ?page=# in the address bar when going from page to page.

Here is how my pagination links are generated:

<a href='{$_SERVER['PHP_SELF']}?page=$nextpage'>Next</a>

How would I go about doing this?

  • 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-06-05T11:33:12+00:00Added an answer on June 5, 2026 at 11:33 am

    You could do something along the lines of:

    // Check if there are any GET parameters
    if (!empty($_GET)) {
        $link = "?page=2";
    
        // Loop through the parameters
        foreach ($_GET as $parameter => $value) {
          // Append the parameter and its value to the new path
          $link .= "&" . $parameter . "=" . urlencode($value);
        }
    }
    
    • 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
QUESTION: What is the proper way to use .get() in conjunction with .one() (or
On my website I use a pagination (similar to that one on the bottom
i am using jquery tabs, and trying to get pagination in each one, everything
I use a get request to receive a list of a data from a
I'm creating a page that's a search result... When you're viewing one of the
The problem is that when I load page 2 for example the URL becomes:
So, I have a page that looks like the following: alt text http://img704.imageshack.us/img704/5973/croppercapture3.png This
I want to stay way from GET params. Don't want to use POST and
How would I go about implementation the queries required for pagination? Basically, when page

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.