Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter: Input class not being loaded (or so I think)

I'm trying to work with the CI framework (PHP), and not having much luck with the core "Input" class.

Here's my code:

$user_name = $this->input->post('username');
$password = $this->input->post('password');

This is the result when I try to load the controller:

A PHP Error was encountered

Severity: Notice

Message: Undefined property: Login::$input

Filename: controllers/login.php

Line Number: 24

Any Tips?

like image 947
CrowderSoup Avatar asked Mar 06 '26 09:03

CrowderSoup


1 Answers

Make sure that your controller extends CI_Controller and that you call the parent constructor in your own:

class Login extends CI_Controller {
    public function __construct() {
        parent::__construct();
    }
    /* the rest of your code... */
}
like image 156
Sean Walsh Avatar answered Mar 07 '26 22:03

Sean Walsh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!