php - Declaring a variable outside a function in CodeIgniter -
i'm new codeigniter. i'm trying output view again after clicking submit view has variable controller, when tried it, doesn't work. <?php class site extends ci_controller{ public $data1['value'] = "what insert"; public function index(){ $this->load->view('home',$this->data1); } public function get_product(){ $data = array( 'product_name' => $this->input->post('prod_name') ); $this->site_model->insert_product($data); $this->load->view('home',$this->data1); } } ?> here's view: <div id="container"> <h1><?php echo $data1;?></h1> <?php echo form_open('site/get_product'); ?> <p> <label for="product">product name </label> <input type="text" id=&q