this is my view page code
<td><a href="<?php echo site_url("Customer/viewpatient/?id=".$id); ?>" ><button type="button" name="admit" class="btn btn-danger" data-toggle="modal" id="btnViewCust">Admit</button></a></td>
this is my controller function
public function viewpatient()
{
$data['id'] = $this->input->post('id');
echo $data['id'];
}
答案 0 :(得分:2)
使用此$ this-&gt; input-&gt; get()
public function viewpatient()
{
$data['id'] = $this->input->get('id');
echo $data['id'];
}
答案 1 :(得分:0)
在您的视图
<td>
<a href="<?php echo site_url("Customer/viewpatient/" . $id); ?>" ><button type="button" name="admit" class="btn btn-danger" data-toggle="modal" id="btnViewCust">Admit</button>
</a>
</td>
控制器功能
public function viewpatient($id = 0)
{
echo $id;
}
您在get请求中发送值并在帖子中捕获。并以这种方式更改您的链接。