Reputation: 57
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>
Upvotes: 0
Views: 1218
Reputation: 12132
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>
Upvotes: 1