'Object Not Found' - Beginner Issue |
[eluser]Butters[/eluser]
Hi folks, I'm new to CodeIgniter and after reading a few tutorials etc I have tried a simple log-in page. I've only got as far as trying to echo out the validation errors as its failing. When you submit the form I'm getting an 'Object Not Found' error at the url localhost/codeigniter/user/login . Here is my form: Code: <div> The controller: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); In routes.php I've set the default controller to 'user' In config.php I've tried setting the index page to index.php,user.php and an empty string. Can anybody spot what I am doing wrong ? If i've left any info out that might be needed to solve the problem let me know. Cheers in advance!
[eluser]Nick_MyShuitings[/eluser]
Perhaps you've autoloaded it, but if not I don't see where you loaded the form_validation library. Also, actually giving us the error really helps debugging.
[eluser]Butters[/eluser]
[quote author="Nick_MyShuitings" date="1303871334"]Perhaps you've autoloaded it, but if not I don't see where you loaded the form_validation library. Also, actually giving us the error really helps debugging.[/quote] Yeah form validation is autoloaded: $autoload['libraries'] = array('form_validation'); The error is: Quote:Object not found!The URL it is trying to hit is: http://localhost/codeigniter/user/login Within the CodeIgniter folder > Applications > Views I have view_login.php and in the controllers folder I have users.php
[eluser]Nick_MyShuitings[/eluser]
Is the controller users or user? because the class is user... so if you have the controller filename as users.php then that might be the issue.
[eluser]Butters[/eluser]
Apologies, that was a typo in my last post. The file is user.php
[eluser]InsiteFX[/eluser]
Your loading your view before it even gets to the form_validation! Code: function login() InsiteFX
[eluser]Butters[/eluser]
[quote author="InsiteFX" date="1303878088"]Your loading your view before it even gets to the form_validation! Code: function login() InsiteFX[/quote] Ah, so I am... I made the change however the same error is occurring, it seems as if the call to the form on the submit button isn't hitting the proper location. Cheers for taking the time to look at this
[eluser]InsiteFX[/eluser]
I do not see your form_open! Code: <div> InsiteFX
[eluser]Aken[/eluser]
You forgot to use the __construct() function in your controller, which calls the CI_Controller __construct() function. Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[eluser]InsiteFX[/eluser]
You do not need the Constructor unless you are setting variables! The constructor is inherited from the CI_Controller! If you are doing something like this then yes you need the Constructor otherwise you do not! Code: private $CI; Here is a good article on Constructors from Greg! Constructor-structor, what's your function? InsiteFX |
Welcome Guest, Not a member yet? Register Sign In |