[eluser]brixxster[/eluser]
Hello everyone.
I have a form which gets data from the user. I use the CI validation function to validate if the user enters the correct data and I use flash_data to display errors right after validating the data inputted from the database. The CI validation works fine and I am only having a problem with flash_data. The question is, why does the user have to click the form twice in order to have the flash_data finally displayed?
CONTROLLER
Code:
if ($emailCheck != Null){
echo $emailCheck[0]->email;
} else {
$this->session->set_flashdata('resetMsg', 'Email not found in database.');
$this->index();
}
VIEW
Code:
<?php if($this->session->flashdata('resetMsg')) : ?>
<div class="error"><?php echo $this->session->flashdata('resetMsg');?></div>
<?php endif; ?>
Thanks