here my controller code
$data['query']= $this->webpages->get_where_custom('parent_id',0);
// i will get $id from view
$data['query']=$this->webpages->get_where_custom('parent_id',$id);
$this->load->view-(template,$data);
in view code i will send $id to controller but its shows undefined variable 'id'
<?php
foreach($query->result() as $row){
$id=$row->id; // how to send this $id to my controller
$page_url=$row->page_url;
$parent_id=$row->parent_id;
$page_headline=$row->page_headline;
foreach($query->result() as $row){
$page_url=$row->page_url;
$page_headline=$row->page_headline;
?>
echo $page headline;
}
}
Insted of:
$this->load->view-(template,$data);
Try:
$this->load->view(template,$data);
your code look like this
$this->load->view('template',$data);
and it is because your didn't put $id in the data you put query
so <?php print_r($query); ?>
<?php print_r($query); ?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.