简体   繁体   English

如何在Codeigniter中将数据从一个视图回显到另一个视图?

[英]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.

相关问题 如何将数据从一个视图页面传递到codeigniter中的另一个视图? - how to pass the data from one view page to another view in codeigniter? 如何在 Codeigniter 中将所有数据从一个数据库克隆到另一个数据库 - How clone all data from one database to another one in Codeigniter CodeIgniter,包括从一个视图到另一个视图的代码? - CodeIgniter, including code from one view into another? 在CodeIgniter中将内容从一个视图包含到另一个视图中 - Include contents from one view to another in CodeIgniter 如何通过使用会话将数据从一个功能传递到Codeigniter中的另一个功能? - How to pass data from one function to another in codeigniter by using session? 如何将表的数据从一个视图发送到 laravel 中的另一个视图 - how to send data of table from one view to another view in laravel 如何在Codeigniter中将帮助程序的结果从一个视图打印到另一个视图 - How do i print my result by helper from one view to another view in codeigniter 如何在Codeigniter中将某些值从一个视图传递到另一个视图? - How can I pass some values from one view to another view in codeigniter? 从一个PHP页面获取数据并将其回显到另一页面 - Take data from one php page and echo it onto another page 如何从一个mysql表获取数据到另一个表的html echo - how to get data from one mysql table to html echo from another table
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM