[eluser]Nicholas Hanks[/eluser]
Thank you very much for the response. I am sorry I should have explained little bit about the controller but here's how it works.
User will request form from ---> requestForm()
before dispatching form view it checks whether user already submitted one or not
If yes the it will set the token and will render a view otherwise it will send message you submitted from once already.
User will submit form in -----> submitRequestForm()
As usual does some validation and if it passes then it sets the session $this->session->set_userdata('received','yes'); and renders a thank you message. If validation fails it send form again with validation error entact.
That's it...
Now I solved this problem. Here what I found
When you enable $db['default']['cache_on'] = TRUE;
Session things sometime gets messed up. So, I had to do this
Code:
if ($this->sess_use_database === TRUE)
{
$this->CI->db->cache_off();
$this->CI->db->where('session_id', $session['session_id']);
if ($this->sess_match_ip == TRUE)
{
$this->CI->db->cache_off();
$this->CI->db->where('ip_address', $session['ip_address']);
}
if ($this->sess_match_useragent == TRUE)
{
$this->CI->db->cache_off();
$this->CI->db->where('user_agent', $session['user_agent']);
}
$this->CI->db->cache_off();
$query = $this->CI->db->get($this->sess_table_name);
// No result? Kill it!
if ($query->num_rows() == 0)
{
$this->sess_destroy();
return FALSE;
}
// Is there custom data? If so, add it to the main session array
$row = $query->row();
if (isset($row->user_data) AND $row->user_data != '')
{
$custom_data = $this->_unserialize($row->user_data);
if (is_array($custom_data))
{
foreach ($custom_data as $key => $val)
{
$session[$key] = $val;
}
}
}
$this->CI->db->cache_on();
}
from library Session.php