Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Call to undefined function redirect()
#1

[eluser]jblack199[/eluser]
As per the title I am having issues with the redirect function on my script. I've looked and looked and cant figure out the issue.

in my autoload.php I've got the following:

Code:
$autoload['helper'] = array('valid_admin', 'url', 'form');

valid_admin is a custom helper, the other two are as it should be.

and here is my index.php which has been changed in the routes.php from welcome to index so that part is working fine.

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Index extends CI_Controller {
    function index () {  
            redirect('/login', 'refresh');
    }
}

and the issue i'm getting is:
Fatal error: Call to undefined function redirect() in /home/thecodes/public_html/qweeri/application/controllers/adm/index.php on line 4

any idea whats up? thanks in advance, 'cause i cant seem to see why its not working...
#2

[eluser]LuckyFella73[/eluser]
Do you have a constructor in your controller?

Code:
class Index extends CI_Controller { {

    function __construct()
    {
        parent::__construct();
    }

}

Don't now if that's the issue but you can try Wink
#3

[eluser]jblack199[/eluser]
hmm.. I hadn't gotten that far, and when i had it in the welcome.php as the main page, the redirect worked fine without it... but once I put it in, the redirect worked fine...

thanks a bunch!
#4

[eluser]LuckyFella73[/eluser]
Nice it works now!

Btw: "index" is a reserved controller-name (per CI userguide).
I guess you could get trouble using that one.




Theme © iAndrew 2016 - Forum software by © MyBB