user3415023
user3415023

Reputation:

My codeigniter hyper links are not working properly?

my hyper links are not working properly...please check the link

localhost/classified/ad_shop-member/admin_main/admin_main/admin_main/admin_main/admin_main/admin_main/product_list

whenever i am clicking again and again on the same link then address bar show the same link..

<ul class="box">
        <li><a href="#"><span>Home</span></a></li>
        <li><a href="admin_main"><span>Add Product</span></a></li> <!-- Active -->
        <li><a href="admin_main/product_list"><span>Product List</span></a></li>
        <li><a href="#"><span>My Orders</span></a></li>
        <li><a href="#"><span>Add Advertisement</span></a></li>
        <li><a href="#"><span>Add Banners</span></a></li>
    </ul>

Upvotes: 0

Views: 118

Answers (2)

swifty
swifty

Reputation: 1147

I recommend you check out the url helper (http://ellislab.com/codeigniter/user-guide/helpers/url_helper.html)

<li><a href="<?php echo site_url('admin_main');?>"><span>Add Product</span></a></li>

This is assuming that your base url is set correctly in application/config/config.php

Upvotes: 0

Hammad
Hammad

Reputation: 2137

Have you set the application base_url in config.php file? You have to first set the base url for your application in that file and then use it in the href tag as:

<li><a href="<?php echo base_url();?>admin_main/product_list"><span>Product List</span></a></li>

Also remember to autoload url helper in autoload.php to be able to use base_url.

Upvotes: 1

Related Questions