My login form was working before but I noticed today it’s not working anymore. I don’t understand why. I’m freaking out. I tried lots of things and kinda narrowed it down to the validation. With this code I should be seeing “its good!” after pressing the submit button but it stays on the “Invalid” and the var_dump() always displays false. On the login form I have a username and password field and a submit button with name=”submit”. The form does submit to the correct controller (login).
public function login()
{
var_dump($this->input->post());
if(!$this->input->post('submit'))
{
echo 'invalid';
$this->load->view('header');
$this->load->view('login');
$this->load->view('footer');
}
else
{
echo 'its good!';
}
}
What about doing a var_dump() or print_r() of $_POST?
If $_POST is empty, have a look at your view and make sure you haven’t set your forms ‘method’ attribute to ‘get’. It should be set to ‘post’.