0

我在 Codeigniter 中开发了简单的自定义网格,我在网格中有以下列

Sl - CheckValue(复选框) - 用户 ID - 用户名 - 电子邮件

所以,如果有人检查任何行并提交,我应该能够获得所选行的值..

所以任何人都可以告诉我如何在codeigniter中做同样的事情..

              function showattendee($id, $offset=0)
{
    $person = $this->Person_model->get_by_id($id)->row();
    $this->form_data->id = $person->tab_classid;
    $this->form_data->classtitle = $person->tab_classtitle;
    $this->form_data->classdate = $person->tab_classtime;
    $this->form_data->createddate = $person->tab_crtdate;
    $this->form_data->peremail = $person->tab_pemail;
    $this->form_data->duration = $person->tab_classduration;

    //Show User Grid - Attendee>>>>>>>>>>>>>>>>>>>>>>>>
    $uri_segment = 0;
    $offset = $this->uri->segment($uri_segment);
    $courses = $this->Mycourses->my_courses($this->limit,$offset,$this-                 >form_data->classtitle)->result();
    // generate pagination
    $this->load->library('pagination');
    $config['base_url'] = site_url('person/index/');
    $config['total_rows'] = $this->Mycourses->count_all();
    $config['per_page'] = $this->limit;
    $config['uri_segment'] = $uri_segment;
    $this->pagination->initialize($config);
    $data['pagination'] = $this->pagination->create_links();
    // generate table data
    $this->load->library('table');
    $this->table->set_empty(" ");
    $this->table->set_heading('Ref#','Check', 'User Id','User Name', 'Email');
    $i = 0 + $offset;
    foreach ($courses as $course)
    {
        $checkarray=array('name'=>'chkclsid[]','id'=>'chkclsid','value'=>$course->user_id);
        $this->table->add_row($course->mycourse_id,form_checkbox($checkarray), $course->user_id, $course->user_name, $course->user_email);
    }
    $data['table'] = $this->table->generate();

//结束网格代码

    // load view
    // set common properties
    $data['title'] = 'Assign Attendees';
    $msg = '';
    $data['message'] = $msg;
    $data['action'] = site_url('person/CreateAttendees');
    //$data['value'] = "sssssssssssssssssss";
    $session_data = $this->session->userdata('logged_in');
    $data['username'] = "<p>Welcome:"." ".$session_data['username']. " | " . anchor('home/logout', 'Logout')." | ". "Userid :"." ".$session_data['id']; "</p>";
    $data['link_back'] = anchor('person/index/','Back to list of Classes',array('class'=>'back'));
    $this->load->view('common/header',$data);
    $this->load->view('adminmenu');
    $this->load->view('addattendee_v', $data);

}
4

1 回答 1

0

当您提交带有选中复选框的数据时,您可以通过以下方式获取这些数据。

$obj = $this->input->post('chkclsid');
echo $obj['0'];
于 2012-11-30T12:16:13.957 回答