Welcome Guest, Not a member yet? Register   Sign In
How to Redirect within a controller functions with passing id
#1

[eluser]JasmineFlower[/eluser]
Hi,

In my project, i need to redirect from one function to another function within Controller.

My controller name home.php

My first functions:

function post_list($id)
{
..... process using id.....
}

Another function:

function update_post()
{
$id=$this->input->post('id');

....Process done here.............

****** NOW HERE I NEED redirect to post_list function with passing this id******
}
#2

[eluser]danmontgomery[/eluser]
Code:
function post_list($id) {
    // ...
}

function update_post() {
    $id = $this->input->post('id');

    // ...

    return $this->post_list($id);
    // or
    redirect('controller_name/post_list/'.$id);
}
#3

[eluser]haileCI[/eluser]
function update_post()
{
$id=$this->input->post(‘id’);
$this->post->list($id);

}


is that?
#4

[eluser]JasmineFlower[/eluser]
Hi,
Thank u so much its working
#5

[eluser]JasmineFlower[/eluser]
In that redirect function is working correctly .

After redirect the page i want to display the updated data, but it displays the old values. how can i refresh the database during redirect?
#6

[eluser]InsiteFX[/eluser]
Code:
redirect('controller_name/post_list/'.$id, 'refresh');

InsiteFX
#7

[eluser]JasmineFlower[/eluser]
Thank u




Theme © iAndrew 2016 - Forum software by © MyBB