Q:

How to link to an element with id on another page from homepage in codeigniter?

I am a beginner in CodeIgniter and want to internally link my a tag on homepage to element with id="gainers" on products page.
I have tried many sources on the net, documentation of CodeIgniter (Views), and videos on youtube but could not get help. My controller has this code.
 public function toLoadProductsPageGainers()
    {
       $this->load->view('vsc_spl_product_from_model#gainers');
    }  

where "gainers" is the id of a segment on the products page.
I want the link which is calling toLoadProductsPageGainers() from my homepage to lead to id="gainers" on the products page. But 404 error is coming.

A:

html code should be 
<a href="<?=site_url("toLoadProductsPageGainers/#gainers")?>">Go To Link</a>

While your controller should be like below 
public function toLoadProductsPageGainers()
{
   $this->load->view('vsc_spl_product_from_model');
}  

