![]() |
Redirect with input - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29) +--- Thread: Redirect with input (/showthread.php?tid=67028) |
Redirect with input - orionstar - 01-03-2017 I think we need something similar like in Laravel: https://laravel.com/docs/5.3/responses#redirecting-with-flashed-session-data https://laravel.com/api/5.2/Illuminate/Http/RedirectResponse.html Why we need this? To show the form in one action method and in the other one handle the data processing... For CodeIgniter 3 I use a similar but very simple solution to achieve the same results, see below... I put the following code to the MY_Controller constructor: PHP Code: $_previous_data = $this->session->flashdata('_previous_data'); ...and I created the following helper method for the redirect: PHP Code: if( ! function_exists('redirect_with_input')) I am not saying we should use something similar, it's just here to show an implementation... Laravel's approach is much cleaner & have more options... RE: Redirect with input - kilishan - 01-03-2017 Yes, something similar to this is on my radar, but I keep forgetting to work on it among all of the other parts. Thanks for the nudge and for sharing your code. RE: Redirect with input - orionstar - 01-04-2017 (01-03-2017, 03:23 PM)kilishan Wrote: Yes, something similar to this is on my radar, but I keep forgetting to work on it among all of the other parts. Thanks for the nudge and for sharing your code. Okay, cool thx. ![]() RE: Redirect with input - kilishan - 01-06-2017 And it's in there. RE: Redirect with input - Diederik - 01-07-2017 Great work! I was looking for such a function a few month back for a project. Good to see its getting integrated ![]() |