I can't passing the variables in view page
this is my controller code
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Management extends CI_Controller {
public function __construct()
{
parent::__construct();
if($this->session->userdata('level') != 1){
redirect('');
}
}
public function hotels()
{
$this->load->model('model_hotels');
$ss['most_view_hotels'] = '23';
$this->load->view("management/header_mng_view");
$this->load->view('management/hotels_mng_view' , $ss , true);
$this->load->view("management/footer_mng_view");
}
}
this is the error
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: most_view_hotels
Filename: management/hotels_mng_view.php
Line Number: 22
hotels_mng_view.php
<?php
echo $most_view_hotels;
foreach($most_view_hotels as $value):
?>
<div class="row">
<div class="cell en">adsf</div>
<div class="cell en">1212</div>
<div class="cell en">12</div>
<div class="cell en">32</div>
</div>
<?php endforeach;?>
most_view_hotelsis not an array theforeachshould display an error. But still it would not be the one given in your post.