Retaining search variables to return to filtered view - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12) +--- Thread: Retaining search variables to return to filtered view (/showthread.php?tid=90685) |
Retaining search variables to return to filtered view - pchriley - 04-18-2024 Hello, My document management system opens by default to a paged table showing all rows in the documents table. Controller: PHP Code: public function index(){ View: PHP Code: <?php if($dms_documents): ?> The 'Description' column for each row is an href link to that record, and opens - routed via the Controller - an edit form for that record. The edit form allows me to amend/save, ignore or delete the record. The edit form action then returns me to the original table view. That all works fine, but I've now introduced a search form so that the resulting version of the table view is filtered according to the search criteria (currently just a simple 'LIKE'): PHP Code: [code]$data = [ This works, but what I cannot fathom out is how to return from the edit form to a table view reflecting the search criteria (also taking into account any changes made via the edit form) rather than to the full dataset. Thanks RE: Retaining search variables to return to filtered view - Bosborne - 04-23-2024 Your answer is to use sessions. https://www.codeigniter.com/user_guide/libraries/sessions.html RE: Retaining search variables to return to filtered view - pchriley - 04-25-2024 (04-23-2024, 03:20 AM)Bosborne Wrote: Your answer is to use sessions. Excellent! Thank you so much - I now understand that I can add the data passed to the table view to the session and recall it as needed. I had previously assumed that sessions were for holding login data etc. Cheers |