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

The Archive Base Latest Questions

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

I have a /payments interface where the user should be able to filter via

  • 0

I have a /payments interface where the user should be able to filter via price range, bank, and other stuff. Those filters are standard select boxes. When I submit the filter form, all the post data goes to another method called payments/search. That method performs the validation, saves the post values into a session flashdata and redirects the user back to /payments passing the flashdata name via URL.

So my standard pagination links with no filters are exactly like this:

payments/index/20/
payments/index/40/
payments/index/60/

And if you submit the filter form, the returning URL is:

payments/index/0/b48c7cbd5489129a337b0a24f830fd93

This works just great. If I change the zero for something else, it paginates just fine. The only issue however is that the << 1 2 3 4 >> page links wont keep the hash after the pagination offset. CodeIgniter is generating the page links ignoring that additional uri segment.

My uri_segment config is already set to 3:

$config['uri_segment'] = 3;

I cannot set uri_segment to 4 because that hash may or may not exists. Any ideas of how can I solve this? Is it mandatory for CI to have the offset as the last segment in the uri? Maybe I am trying an incorrect approach, so I am all ears.

Thank you folks.

edit: Why am I passing the flashdata name via uri you might ask? because it allows the user to open several browser tabs and do different searches in each tab. For each filtering you do, a new flashdata var is generated.

  • 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-15T11:59:34+00:00Added an answer on May 15, 2026 at 11:59 am

    Just for users coming from Google, here is the solution:

    In the pagination config array, I changed my base_url for this:

    $config['base_url'] = site_url('payments/index/' . $this->uri->segment(3) . '/' . $this->uri->segment(4));
    

    Where segment(3) is my offset number and segment(4) is the hash. So, in this case, the hash may or may not exists and the pagination will still work.

    Another approach could be this: If you go to payments, and there is no flashdata ID in the URL, it redirects the user to payments/search and create an empty array with empty filters. Then it redirects back to payments/_NEW_FLASHDATA_ID_HERE_. This way, the URL will always have a flashdata ID in the URL and you can have the pagination offset in the last URI segment as usual.

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

Sidebar

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.