• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
In Dropdown href not taking method in controller

#1
I have below code in view file - menu.php: (lines reduced for ease of checking..)
______________________________________________
<h3>ABC Fruits</h3>
<div id="Startup">

<ul class="" id="">
<li>Format
            <ul><li><a href="localhost:8015/citest3/index.php/soft1/sell">sell</a></li></ul>
            <ul><li><a href="localhost:8015/citest3/index.php/soft1/buy">buy</a></li></ul>
</li>

<li>Exit</li>
</ul>
__________________________________________________



And below Code in Controller - Soft1.php file:
___________________________________________________
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Soft1 extends CI_Controller {

public function index()
    {
       $this->load->view('menu');
    }
    
    public function sell()
        {
            echo "Sales Done";
        }
    
    public function buy()
        {
            echo "Purchase Done";
        }
    
}
___________________________________-

I get a menu as per attachment when I run the code. But when I click on menu option I expect the respective function (method) in the controller to run. (for eg: if I click on sell - the sell method in controller should run & "Sales Done" should get displayed). But it is not responding. But if I put "www.example.com" it goes there. Also, when I copy the "localhost:8015/citest3/index.php/soft1/buy" on browser it works! 

But it is not working when I click on the menu item.

What could be the problem? please suggest a solution.


Attached Files Thumbnail(s)
   
Reply


Messages In This Thread
In Dropdown href not taking method in controller - by Sovani Shreeniwas - 02-08-2019, 03:48 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.