[eluser]Unknown[/eluser]
I have method to check if the email is already use for registration. If it is used, it sends message via session flashdata. When I tried to create new user with same email, nothing is being showed, but if I refresh page, message is showed properly. What seams to be the problem.
Code for creating message:
Code:
function create() {
$this->load->library('form_validation');
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
$this->form_validation->set_rules('ime', 'trim|required');
$this->form_validation->set_rules('prezime', 'trim|required');
$this->form_validation->set_rules('pass', 'trim|required|min_lenght[4]|max_lenght[32]');
$this->form_validation->set_rules('pass2', 'trim|required|matches[password]');
if($this->form_validation->run() == FALSE){$this->index(); }
else {if( $this->admin_model->create_user() == FALSE)
{
$this->session->set_flashdata('message', 'Ovaj email je upotrebljen za kreiranje admina');
$message = $this->session->flashdata('message');
$data['message']= $message;
$data['main_content'] = 'admin_login';
$data['title'] = 'Administrator Login';
$this->load->view('admin/template', $data);
}
else
{
$this->index();
}
}
}//end of create
And this is the code for generate message:
Code:
<?php if(isset($message)) : ?>
<div id="error_text"><?php echo $message ?></div>
<?php endif; ?>