0

I want to pass this value in controller function, fetching id in the query string from the database:

<a href="<?php echo base_url()?>.'index.php?n=<?php echo p->id?>'/control/show'">show</a> 
1
  • what is the controller and the method, you are trying to call? and what is the parameter passed? Commented Aug 17, 2015 at 19:09

1 Answer 1

1

Your URL is incorrect. Your anchor, when clicked will redirect to this:

http://localhost/index.php?n=3/control/show

CI will break error out since it does not see the controller.

You need to first create your controller like this:

class Control extends CI_Controller{

    public function show($id){
       // your code here
    }

}

Now you can use the following URL:

http://localhost/index.php/control/show/3

Or in your anchor:

<a href="<?php echo base_url() ?>index.php/control/show/<?php echo $p->id ?>">show</a>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.