Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am getting an ID from a url like:

PHP
<?php echo base_url();?>Product/product/<?php echo $product->id;?>"

In my sidebar on the same function[view -> Product/product] I am getting it correctly. but when I click some other function in my sidebar the Id is not comming like:

What I have tried:

<pre lang="PHP">public function Product($id)
{
     $this->data['product'] = $this->prod->get_product($id);
    $this->load->view('products/header');
    $this->load->view('products/topnav');
    $this->load->view('products/sidebar',$this->data);
    $this->load->view('products/home',$this->data);
    $this->load->view('products/footer');
}


it is working on this page as expected, but when I jump to different function in my sidebar the id is not working because it is not getting it... like:

public function Data()
{
    $id=$this->Product($id);
    $this->data['product'] = $this->prod->get_product($id);
     $this->load->view('products/header');
    $this->load->view('products/topnav');
    $this->load->view('products/sidebar', $this->data);
    $this->load->view('products/data');
    $this->load->view('products/footer');

}


What I want: How to get the Id which I pass above to all my sidebar functions.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900