Welcome Guest, Not a member yet? Register   Sign In
Redirect with input

I think we need something similar like in Laravel: 

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');
$_POST    $_previous_data['post'];
$_GET    $_previous_data['get'];

...and I created the following helper method for the redirect:
PHP Code:
if( ! function_exists('redirect_with_input'))
redirect_with_input($uri ''$method 'auto'$code NULL)
$CI =& get_instance();

$data = array(
'post'    => $CI->input->post(),
'get'    => $CI->input->get()



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...

Messages In This Thread
Redirect with input - by orionstar - 01-03-2017, 01:53 PM
RE: Redirect with input - by kilishan - 01-03-2017, 03:23 PM
RE: Redirect with input - by orionstar - 01-04-2017, 05:15 AM
RE: Redirect with input - by kilishan - 01-06-2017, 07:38 PM
RE: Redirect with input - by Diederik - 01-07-2017, 01:14 AM

Theme © iAndrew 2016 - Forum software by © MyBB