This seems simply but can't find an answer. I have a login controller with a data title variable:
$data['title'] = 'Login here';
$this->load->view('login/login_view', $data);
The view is loaded correctly with the:
<title>Login here</title>
Cool! But when I login using the form and send the data to the "login_verify" controller it checks to see if there is a match or if the fields were populated and if false it returns to the original login view:
function index() {
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username', 'trim|required');
$this->form_validation->set_rules('password', 'Password', 'trim|required|callback_check_database');
if($this->form_validation->run() == FALSE) {
//Field validation failed. User redirected to login page
$this->load->view('login/login_view');
} else {
//Go to private area
redirect('home', 'refresh');
}
}
How do I get the original $title variable back into the login view if the validation fails? Do I redeclare the original login controller before I load the login view? If so, how? Obviously I don't want to have to redefine the $title variable in the "login_verify" controller.
Thanks