我如何循环表单元素并获取值而不是保存到数据库,我有 5 个表单输入,并且我有带有复选框的数据网格来选择行...
所以我想知道如何使用 php 和 codeigniter 执行相同的操作。,,,, 我真的需要帮助来解决问题。
function showattendee($id)
{
// set validation properties
$this->_set_rules();
// prefill form values
$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;
$uri_segment = 0;
$offset = $this->uri->segment($uri_segment);
$users = $this->User_model->get_paged_list($this->limit, $offset)- >result();
$this->load->library('pagination');
$config['base_url'] = site_url('person/index/');
$config['total_rows'] = $this->User_model->count_all();
$config['per_page'] = $this->limit;
$config['uri_segment'] = $uri_segment;
$this->pagination->initialize($config);
$data['pagination'] = $this->pagination->create_links();
$this->load->library('table');
$this->table->set_empty(" ");
$this->table->set_heading('', 'User Id','User Name', 'Email', 'Language','Actions');
$i = 0 + $offset;
foreach ($users as $user)
{
$checkarray=array('name'=>'chkclsid[]',
'id'=>'chkclsid','value'=>$user->user_id);
$this->table->add_row(form_checkbox($checkarray),
$user->user_id, $user->user_name, $user->user_email,$user->user_language,
anchor('person/view/'.$user->user_id,'view',array('class'=>'view')).' '.
anchor('person/update/'.$user->user_id,'update',
array('class'=>'update')).''.
anchor('person/showattendee/'.$user- >user_id,
'Attendee',array('class'=>'attendee')).' '.
anchor('person/delete/'.$user->user_id,'delete'
,array('class'=>'delete',
'onclick'=>"return confirm('Are you sure want to delete this person?')"))
);
}
$data['table'] = $this->table->generate();
// load view
// set common properties
$data['title'] = 'Assign Attendees';
$data['message'] = '';
$data['action'] = site_url('person/validatecheckbox');
$data['value'] = "sssssssssssssssssss";
$data['link_back'] = anchor('person/index/',
'Back to list ofClasses',array('class'=>'back'));
$this->load->view('common/header');
$this->load->view('adminmenu');
$this->load->view('addattendee_v', $data);
}
所以我想循环所有表单字段,包括复选框值并传递给数据库以保存数据。