[英]How to send Data form view to controller through URL in codeigniter and how i get data in controller
How to send Data form view to controller through URL in codeigniter and how I get data in controller? 如何通过Codeigniter中的URL将数据表单视图发送到控制器,以及如何在控制器中获取数据?
<div class="col-md-3 col-md-3-text"> <div class="classWithPad"><img src="<?php echo base_url(); echo 'assets/img/'; echo $title[$i]->image; ?>"/> <?php $id = $title[$i]->category_id; ?>
<div class="title_banner"><a href="<?php echo site_url('Welcome/category','' ) ?>" class="mhover"><?php echo $title[$i]->category_name; ?></a></div>
</div>
</div>
send like this 这样发送
You have to use $_GET[] method of php: 您必须使用php的$ _GET []方法:
<a href="<?php echo base_url()?>your_Controller/your_function?id=1">My Data</a>
This will redirect to your controller
where you had your function
and within your_function you have to use $_GET['id']
as 这将重定向到您拥有
function
controller
,在your_function中,您必须使用$_GET['id']
作为
function your_function() {
$id = $this->input->get('id');
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.