Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5995927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:01:49+00:00 2026-05-23T00:01:49+00:00

THIS IS FIXED, I had named my function the same name as my controller,

  • 0

THIS IS FIXED, I had named my function the same name as my controller, changed function name from login to do_login, now works a treat, thanks all

Hi this should be really simple:-

Im writing a php site using CI

im trying to get a simple POST variable im my controler using:

public function login()
{
    $something = $this->input->post('something');
}

This on a controller name Login.php , the idea is have a form pass the POST data to this function at login/login, but I get this error

A PHP Error was encountered

Severity: Notice

Message: Undefined property:
Login::$input

Filename: controllers/login.php

Line Number: 38

( ! ) Fatal error: Call to a member
function post() on a non-object in
C:\wamp\www\rcity\application\controllers\login.php
on line 38

Ive tried get_instance(), but I can refer to everything else as $this inside the controller, as soon as I mention POST it dies, and off what ive read the input class is already loaded so thats not the issue, any ideas?

Thanks

HERES the full file for login.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends CI_Controller {

    public function index()
    {
        $data = array(
               'title' => '*** | Login',

                );
                $this->load->helper('login_helper');
                $this->load->view('head_view',$data);
                if (check_login()==TRUE){$this->load->view('header_logged_in');}
                else {$this->load->view('header_logged_out');}
                $this->load->view('nav_view');
                $this->load->view('login_view');
                $this->load->view('footer_view');

    }
        public function login()
        {
            $something = $this->input->post('something');
            $this->load->helper('login_helper');

        }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:01:50+00:00Added an answer on May 23, 2026 at 12:01 am

    You can’t name your function the same as the controller… that would make it a constructor.

    You’re best best is to do this:

    function __construct()
    {
        parent::__construct();
        // the stuff you currently have in index()
    }
    
    public function index()
    {
        $this->login_user();
    }
    
    public function login_user()
    {
        // your code here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this would be easy with position:fixed, but unfortanately I'm stuck with supporting
I'm implementing a table with a fixed header using this kind of setup: <div
Edit: This is a confirmed bug in jQuery 1.3.1. It is fixed in jQuery
I came in this morning, fired up my app in the same way as
This is my first post here and I wanted to get some input from
I am trying to work through this question and I have had little success
Here is function , <script type=text/javascript> $(document).ready(function() { getRecordspage(1, 5); $(a.page-numbers).click(function() { alert(1); getRecordspage($(this).text(),
This is a bit of a long shot, but if anyone can figure it
This is starting to vex me. I recently decided to clear out my FTP,
This is kinda oddball, but I was poking around with the GNU assembler today

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.