I'm fairly new to CI and am trying to redirect a user to a view, with my own data, from a method inside a controller, like so:
class Welcome extends CI_Controller {
public function doLogin() {
extract($_POST);
$this->load->library("form_validation");
$this->form_validation->set_rules('email', 'Email', 'required|trim|valid_email');
$this->form_validation->set_rules('password', 'Password', 'required|trim');
if ($this->form_validation->run() == FALSE)
{
exit;
}
else {
if ($this->welcome_model->loginuser($email,$password)==true) {
header("Location: ".base_url()."explore");
}
else {
$data['errors'][] = "Email and password do not match.";
$this->load->view('header');
$this->load->view('welcome',$data);
}
return true;
}
}
}
As you can see the lower part is supposed to load /welcome, but instead loads /welcome/doLogin
Is there a way to load the view like the constructor? so it will load /welcome only?