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 ran into a problem where I declared a function this way: struct my_struct
The situation is this: a table that is used in a query (name it
So... this is beyond strange. I had an app that was running perfectly fine
I'm using Grails 1.3.7. I have some code that uses the built-in base64Encode function
I have a new error with the code below. Originally I had some classes
Today I had a problem with some routing in my ASP.NET MVC 3 application
I'm currently writing a program, and couldn't figure out why I got an error
I am trying to use the drop event of fancy captcha (http://www.webdesignbeach.com/beachbar/ajax-fancy-captcha-jquery-plugin) but it
I'm trying to set up a remote validation with the jQuery validation plugin 1.8.0
I need to display the gesture library as a bitmap images. The code below

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.