[eluser]gmcms[/eluser]
Hi all, I have a peace of code that cannot run without error:
Code:
Cannot modify header information - headers already sent by (output started at ....****..../form_validation_lang.php:1)
The code below:
Code:
public function index()
{
$this->lang->load('login');
$data = array();
$this->form_validation->set_rules('username', 'lang:username', 'required|valid_email');
$this->form_validation->set_rules('password', 'lang:password', 'required');
if ($this->form_validation->run() == TRUE)
{
// attempt to login
if($this->securelogin->login($this->input->post('username', TRUE), $this->input->post('password', TRUE))) {
// success
redirect(base_url());
}
else
{
$data = array(
'error' => 'login_failed'
);
}
}
$this->load->view('login', $data);
}
I cannot understand how to avoid the problem, even after a lot of search in the forum... each time I remove form_validation->run() the redirect is able to run.
Please what's the issue?
Thanks
Regards