Getting pagination to work with POSTED variables |
[eluser]worchyld[/eluser]
I have a paginated list of customers, and on the same page I also have a form where you can add a customer (not implmented yet). The form sends back to the same page, and a redirect is actioned so that it doesn't give that crappy cached POSTed variables message. In order for it to remember the offset I force the session variable to remember the offset, except that when I click page 1 it never lets me get back to page 1 at all. How do I fix this? This is what I want the page to handle: 1) Paging with GET variables 2) Paging with POST variables 3) Handle incoming POSTed form data which sends an offset 4) Post a "Successfully saved message" 5) Stop the page from displaying the cached POSTed variables message when you press F5 6) Remember what page (offset) you are on, yet still allow you to get back to page 1. Here is the code. Code: <?php Code: <?php Code: <!--
[eluser]worchyld[/eluser]
Okay, seeing as there's been no replies on this, I guess I have try a different idea; 1) Are examples of a paginated form that works with posted variables that doesn't have that annoying cached POSTed variables message? 2) How did you make it remember the success message and the offset, and yet still allow you to get back to page 1? Examples of combining pagination with a form would be great!
[eluser]worchyld[/eluser]
Still no replies? I guess I need to supply the original code in full to get a reply? 1. You can download the controller here; http://www.filepanda.com/get/mztkwbbs/ Installation instructions; rename to .php file and get rid of the phrase "controller_" and place file in controller folder 2.1 You can download the model here; (Rename as .php file, and place in model folder) http://www.filepanda.com/get/wh2fa8pb/ 3. You can download the view file here; (Remove view_ from title, rename as .php and put in view folder) http://www.filepanda.com/get/nhjluml8/ Just to summarize. 1. There is a paginated list of customers. Using GET works, there is no issue with pagniation. 2. There is a form which appears on the page which will allow you to add new customers (not implemented yet). 3. Pressing submit on the form produces a success message, after a redirect (to prevent posted variables message) 4. But it won't remember the offset. Using a session is the only way to solve this, except that it won't let you go back to page 1. 5. Getting rid of the redirect and using a normal view page means that the session message is never displayed until the next time you go to the page. I don't know what else to do to make it clear what I'm trying to do? I guess I can always upload a demo.
[eluser]FarCoder[/eluser]
Heya, use sessions, you can always store data there and then check what you need. |
Welcome Guest, Not a member yet? Register Sign In |