0

Im working on CodeIgniter Framework. I used the library session without problems, getting data like this $this->session->usserdata('IdUsuario') this is ok.

But after uses form_validation :

  public function verify_password()
    {
      $this->load->library('form_validation');

            $this->form_validation->set_rules('Password', 'Contraseña', 'required|trim|callback_correct_password');
            $this->form_validation->set_rules('Password1', 'Nueva ontraseña', 'required|trim');
            $this->form_validation->set_rules('Password2', 'Repetir contraseña', 'required|trim|matches[Password1]');

            $this->form_validation->set_message('correct_password', 'Contraseña incorrecta');
            $this->form_validation->set_message('required', 'El campo %s es obligatorio.');
            $this->form_validation->set_message('matches', 'El campo %s no es igual que el campo %s.');
            if ($this->form_validation->run() == FALSE) {
                $this->edit_password();
            } else {
                   $this->Opciones_model->save_password($this->input->post('Password'), $this->session->usserdata('IdUsuario'));
                   $this->index();
        }
}

I get every time:

Fatal error: Call to undefined method CI_Session::usserdata()

This happens only when I use validation + session, I tried few differents tries but always the same error.

Session is defined on autoload file (Its working).

3

1 Answer 1

1

You have miss spelled usserdata change to userdata

Change

$this->session->usserdata('IdUsuario')

To

$this->session->userdata('IdUsuario')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.