[eluser]cinewbie81[/eluser]
Hi all,
I have 3 controller class files as following:
globalclass.php
Code:
class Globalclass extends Controller {
var $loginName
function Globalclass()
{
parent::Controller();
}
function setLoginName($myloginname)
{
$this->loginname = $myloginname;
}
}
login.php - Extend Globalclass
Code:
class Login extends Globalclass {
function Login()
{
parent::Globalsetting();
$this->load->helper(array('url','form'));
}
function index()
{
$this->load->view('form_login', null);
}
function afterlogin()
{
$username = $this->input->post('user_name');
$this->setLoginName($username);
redirect('home');
}
}
home.php - Extend Globalclass
Code:
class Home extends Globalclass {
function Home()
{
// load library and helper files
parent::Controller();
$this->load->helper(array('url','form' ));
}
function index()
{
echo $this->loginname;
}
}
In afterlogin() function for Login.php class, I call this statement "$this->setLoginName($username)", which will set variable $loginName in Class Globalclass.php to the value i passes. Then i redirect the system to Home and echo $this->loginname value, it return me nothing. Why is that so anyone ??