ask9 Posted January 23, 2012 Share Posted January 23, 2012 :'( Still forgetting it. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $data = array(); class Main extends CI_Controller { public function __construct() { parent::__construct(); $this->load->helper('form'); $this->load->helper('html'); $this->load->helper('url'); $this->load->library('ion_auth'); $this->load->library('session'); $this->load->library('form_validation'); $this->load->database(); //$this->load->model('prod_m'); } function login() { $this->$data['header'] = $this->load->view('header', null, TRUE); $this->load->view('front_page', $this->data); } } /* End of file main.php */ /* Location: ./application/controllers/main.php */ All I just is to make the $data array variable as public and works across all function inside the class. Where did I made wrong? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/255572-undefined-variable-basic-mistake-~sigh~/ Share on other sites More sharing options...
phpSensei Posted January 23, 2012 Share Posted January 23, 2012 The $data variable is defined outside of the class scope. Link to comment https://forums.phpfreaks.com/topic/255572-undefined-variable-basic-mistake-~sigh~/#findComment-1310231 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.