CI 3 - input class |
Hi,
Apologies if this is repeated. The documentation says the input class is Quote:initialized automatically by the system so there is no need to do it manually. But this code Code: $email = $this->input->post('email'); is generating this error Quote:Fatal error: Call to undefined function post() in /home/ubuntu/workspace/application/controllers/admin/Homepage.php on line 46 What am I doing wrong ?
Does your Homepage class inherit directly or indirectly the CI_Controller class?
Edit: 2. If no success, see what would happen if you create a constructor for Homepage and inside it you call the parent constructor.
I trust you remembered to call the inherited constructor? That is what triggers the automatic loading of goodies.
In your controller: Code: function __construct() { parent::__construct();} (10-31-2015, 01:31 PM)ciadmin Wrote: I trust you remembered to call the inherited constructor? That is what triggers the automatic loading of goodies. That's redundant ... the important thing to remember is to call the parent constructor if you use a constructor in your class. Having no __construct() will automatically inherit the parent one.
Hi All,
Thanks for the responses. I believe the issue was actually with this line Code: $password = $this->input-post('password'); I missed the greater than. Thanks again for the responses. Paul.
@Narf
You are correct, I hesitated a little, because I have the habit always to put a constructor in this "placeholder" state as ciadmin has written. This simplifies thinking. And then, rarely this constructor stays as it was initially, the place is prepared for adding more lines. (11-01-2015, 06:09 AM)ivantcholakov Wrote: @Narf Yea, I get the logic behind it, but I'm always against having unnecessary code. |
Welcome Guest, Not a member yet? Register Sign In |