For the last couple of days my frustration has grown to new heights. Im trying to do a simple login system in codeigniter and I cant get it to work properly.
when submitting the login form I get the following error:
The requested URL /wishlist/login_controller/login was not found on this server.
Here is the form:
<form method="post" action="<?php echo base_url()?>login_controller/login">
<input type="text"placeholder="E-mail" id="email" name="email">
<input type="password" placeholder="Password" id="password" name="password">
<input class="btn btn-primary span2" type="submit" id="sign-in" value="Sign In">
</form>
Here is my login function in login_controller:
class Login extends CI_Controller {
function login() {
$data['error'] = 0;
if ($_POST) {
$this->load->model('user_model');
$email = $this->input->post('email', true);
$password = $this->input->post('password', true);
$user = $this->user_model->login($email, $password);
if (!$user) {
$data['error'] = 1;
} else {
$this->session->set_userdata('userID', $user['userID']);
$this->session->set_userdata('firstname', $user['firstname']);
redirect(base_url().'admin_controller');
}
}
$this->load->view('home_view');
}
I'm using wampserver on localhost. Here is the url that it tries to access: localhost/wishlist/login_controller/login
Am I correct in assuming that the first part after base_url() is the controller and the second part is the function in that controller?
A couple of settings from the config folder.
$config['base_url'] = '';
$config['index_page'] = 'index.php';
$route['default_controller'] = "site_controller";