CodeIgniter Forums
Need Refresh in Code Igniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Need Refresh in Code Igniter (/showthread.php?tid=18771)



Need Refresh in Code Igniter - El Forum - 05-17-2009

[eluser]developer_rtpl[/eluser]
I am facing refresh problem in code igniter, for eg:- When I edit a value in a record in CI n then I need to refresh that page to see the changes..Without refresh it shows the old value of that record. I am also facing the same problem when I submit a form or delete any record.Please suggest some solution for that.


Need Refresh in Code Igniter - El Forum - 05-17-2009

[eluser]Thorpe Obazee[/eluser]
Code:
redirect('the_last_uri_segments');
You will probably use this.

For example, you are here: http://localhost/page/edit/1 and then save to the same url, you just redirect to redirect('page/edit/1') or redirect(current_url());

Another sample with the same principle:

Code:
if ($this->form_validation->run('calendar_add') === TRUE)
{
    $this->calendars_model->name = $this->input->post('name');
    $this->calendars_model->description = $this->input->post('description');
    $this->calendars_model->save($id);
    $this->session->set_flashdata('message', 'Calendar Saved');
    redirect(current_url());
}



Need Refresh in Code Igniter - El Forum - 05-17-2009

[eluser]Cro_Crx[/eluser]
bargainph: I think he's talking about losing form data when posting or refreshing, I could be wrong though.
Ranosys: Can you post a snippet of your code so we can have a look at what you're trying to do?


Need Refresh in Code Igniter - El Forum - 05-17-2009

[eluser]Thorpe Obazee[/eluser]
[quote author="Cro_Crx" date="1242641858"]bargainph: I think he's talking about losing form data when posting or refreshing, I could be wrong though.
Ranosys: Can you post a snippet of your code so we can have a look at what you're trying to do?[/quote]

Err... is he?

He says, he sees the changes but only when he refreshes the page, which means he actually is updating the data.


Need Refresh in Code Igniter - El Forum - 05-17-2009

[eluser]Cro_Crx[/eluser]
Sorry my bad, you are correct i just read it again Smile I knew i wrote "I think" for a reason. LOL


Need Refresh in Code Igniter - El Forum - 05-17-2009

[eluser]Thorpe Obazee[/eluser]
That's very normal. I don't usually 'read' a whole post sometimes and read a whole post and still miss something (a lot of things).. Smile