Welcome Guest, Not a member yet? Register   Sign In
Redirect with data
#1

[eluser]Gerep[/eluser]
Is it possible to return $data on a Redirect?

I need to reload my controller to get some information and also display a message.

Thanks in advance.
#2

[eluser]Cristian Gilè[/eluser]
You can use session flashdata.

Read the session class guide: http://ellislab.com/codeigniter/user-gui...sions.html

For example:

Code:
$this->session->set_flashdata('message', $msg_data);
redirect('page/target');

on the page target you can display the message with:
Code:
$this->session->flashdata('message');
#3

[eluser]Atharva[/eluser]
you can fetch the data from the function to which you are redirecting
Code:
redirect('controller/func1/'.$id,'location');

//in controller / function

function func1($id){
//fetch the data from database, show message etc
$data['message'] = 'whatever';
$this->load->view('load_view',$data);
}

Hope this helps.
#4

[eluser]Gerep[/eluser]
Thanks guys, I solved the problem with session. Thanks a lot for your time and attention.




Theme © iAndrew 2016 - Forum software by © MyBB