简体   繁体   English

在Codeigniter中打开新表格后提交一份表格数据

[英]one form data submit after new form open in codeigniter

I want help for form submit 我需要表单提交的帮助

Problem : when one form submit after new form open and i need also few data of first form data in second form how i can do this 问题:当一个表单在新表单打开后提交并且我也需要第二表单中的第一表单数据很少时,我该怎么做

$courseData['COURSE_ID']=$this->input->get_post( 'COURSE_ID');
$courseData['COURSE_NAME']=$this->input->get_post( 'COURSE_NAME');
$this->data['new_content']=$this->load->view('admin/unit/index',$courseData,true);

this code is try COURSE_ID and COURSE_NAME need in second form so what can i do ?? 此代码尝试使用第二种形式的COURSE_ID和COURSE_NAME,所以我该怎么办?

You can use flashdata, which is a part of the session library of codeigniter. 您可以使用flashdata,它是codeigniter会话库的一部分。

Flashdatas are session that is only kept for the next request. Flashdata是仅保留用于下一个请求的会话。 So the idea is to submit the form, keep the values you want in the flash data, then use it. 因此,想法是提交表单,将所需的值保留在闪存数据中,然后使用它。

How flash data works: 1. Set flashdata 2. The flash data is available for the next refresh/request 3. It is now gone. 闪存数据的工作方式:1.设置闪存数据2.闪存数据可用于下一次刷新/请求3.现在消失了。

your code should be 您的代码应该是

function post_form()
{
    $this->session->set_flashdata('session_name', $this->input->post('name');
    //Your other codes
}

To access the flast data, simply use the code 要访问快速数据,只需使用代码

<?php echo $this->session->flashdata('session_name'); ?>

You can read more about flashdatas in the user guide. 您可以在用户指南中阅读有关flashdata的更多信息。

Goodluck meyt 祝你好运

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM