Md Ghouse Saqlain
Md Ghouse Saqlain

Reputation: 39

how to redirect the page with data through codeigniter

$data['family_info'] = $this->Registration->getFamilyDetails($student_id);
redirect("Application/studentRegistration/".$student_id,$data);
$this->load->view("Application/familyInfo/".$student_id);

i would like to redirect the controller with some data as mysql recordset but when im trying with redirect - its now giving back the data, while trying to view function i can but i unable to send student id as a query string.

CI/index.php/Application/familyInfo/182

unbale to get data to this page and using redirect.
using view i can get the data but unable to get the querystring.

Upvotes: 0

Views: 677

Answers (2)

Nere
Nere

Reputation: 4097

You only can pass the id only from redirect but not the data as $this->load->view, to get back the data just simply do like this:

public function studentRegistration($student_id)
{
    $data['family_info'] = $this->Registration->getFamilyDetails($student_id);
    $this->load->view('Application/studentRegistration/'.$student_id,$data);
}

Upvotes: 0

Pupil
Pupil

Reputation: 23958

Your code will leave control after you redirect the page.

Loading view after redirection does not work.

What you can do is: you are already in sending us through redirection.

After redirection, on the destination page, get data depending upon passed id.

Upvotes: 2

Related Questions