Welcome Guest, Not a member yet? Register   Sign In
Passing variable to view not working...
#1

[eluser]Chris.Campbell[/eluser]
I really cannot figure this out.. any help is greatly appreciated.

My controller:
Code:
<?php

class Welcome extends Controller {

    function Welcome()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $data['username'] = "Hello";
        $this->load->view('welcome_message', $data);
    }
}
?>

My view:
Code:
<?php echo $data['username']; ?>

The error:
Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined variable: data

Filename: views/welcome_message.php

Line Number: 60


Messages In This Thread
Passing variable to view not working... - by El Forum - 02-13-2008, 04:45 PM
Passing variable to view not working... - by El Forum - 02-13-2008, 04:46 PM
Passing variable to view not working... - by El Forum - 02-13-2008, 04:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB