I'm wondering if did I just found a bug or the amount of hours programming might not let me see the obvious?
Here's an example of my code:
class home extends CI_Controller
{
public function __construct()
{
}
public function edit()
{
// Prints: John
print_r($this->session->userdata('name'));
$this->load->view('home/edit');
}
public function ajax_edit()
{
$this->session->userdata('name', 'Obama');
// Prints: Obama
print_r($this->session->userdata('name'));
}
}
I call the function ajax_edit
by ajax, and the print is "Obama", which is correct. After that, I refresh the page (to the edit
function) and the output of the name
is "John".
Why in god's heaven isn't the session updated with the value "Obama"? It seems that after refreshing it resets or something and backs to the old value "John".