[英]How to echo data from one view to another one in Codeigniter?
I have two function in my Main Controller, one is for the normal user data, and the other one is for updating the results... How is it possible to echo out nicely in the index view? 我的主控制器中有两个功能,一个用于普通用户数据,另一个用于更新结果...如何在索引视图中很好地回显?
public function index()
{
$data['adat'] = $this->Sajat->get_data();
$this->load->view('index', $data);
}
public function update_st() {
$id = $this->input->post('did');
$name = $this->input->post('dname');
$data = array(
'Ticket' => $this->input->post('dticket'),
'Date' => $this->input->post('ddate')
);
echo $name; // **comment
$this->Sajat->update_reg($id,$name,$data);
$this->index();
}
comment = it works but its really ugly, i want to style it and I want to echo to the index view.... Is it possible?? comment =它有效,但是它确实很丑陋,我想为其设置样式,并希望向索引视图回显...。可能吗? How can I pass 我该如何通过
$name
from update_st() view to index() view? 从update_st()视图到index()视图? Thanks for helping me out. 谢谢你的协助。
Model from comment 来自评论的模型
public function get_data() {
$this->db->select('*');
$this->db->from('users');
$query = $this->db->get();
return $query->result();
}
In update_st function you can simply pass data like this, 在update_st函数中,您可以像这样简单地传递数据,
$data['name'] = $name;
$this->load->view('index', $data);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.