[eluser]Unknown[/eluser]
Hi people,
As I read from CI User Guide
Quote:CodeIgniter supports "flashdata", or session data that will only be available for the next server request, and are then automatically cleared.
May I know what does it mean by saying "next server request"?
Let say I do an
Code:
echo $this->session->flashdata('test');
then is it considered as a "server request"?
This is my problem, please take a look at my sample code below.
At my Model.
Code:
function check(param)
{
if(user_exist)
{
if(activated)
{
return TRUE;
}else
{
$this->session->set_flashdata('key','User not activated');
}
}else
{
$this->session->set_flashdata('key','Invalid username or password');
}
}
At my Controller I did not call the flashdata
At my View.
Code:
if ($this->session->flashdata('key'))
{
echo '<div class="error">' . $this->session->flashdata('key') . '</div>';
}
When I do like above, an error message will show 2 times even the condition is different.
For e.g. for an record that not activated
- 1st time: Key in correct username and password --> Show 'User not activated'
- 2nd time: Key in invalid username and password --> Still show 'User not activated'
- 3rd time: Key in invalid username and password --> Change to 'Invalid username or password'
How can I solve this problem? I still want to use flashdata instead of sending data array to the View.
Thank you so much!