我想之前验证我的编辑形式发送数据的编辑形式,但我得到这个错误如何验证在笨
未定义抵消:0
现在看来似乎是无法取得ID。我怎么解决这个问题?
这是我的代码
public function update_Papers_view()
{
$id = $this->uri->segment('3');
$query = $this->db->get_where("papers", array("id" => $id));
$data['sucss'] = $query->result();
$data['id'] = $id;
$this->load->view('Layout/menu');
$this->load->view('Papers/edit_papers ', $data);
$this->load->view('Layout/footer');
}
public function update_Papers()
{
$this->load->model('PapersModel');
$this->form_validation->set_rules('name_person', 'name_person', 'required', array('required' => 'الرجاء ادخال الاسم'));
$this->form_validation->set_rules('name', 'name', 'required', array('required' => 'الرجاء ادخال اسم الورقه'));
if ($this->form_validation->run() === false) {
redirect('Paperscon/update_Papers_view');
} else {
$data = array(
'name_person' => $this->input->post('name_person'),
'name' => $this->input->post('name'),
'type' => $this->input->post('type'),
'date_paper' => $this->input->post('date_paper'),
'address' => $this->input->post('address'),
);
$id = $this->input->post('id');
$this->PapersModel->update($data, $id);
$query = $this->db->get("papers");
$data['sucss'] = $query->result();
$this->load->view('Layout/menu');
$this->load->view('Papers/show_papers', $data);
$this->load->view('Layout/footer');
}
}
您确定您在POST中获得ID吗?尝试print_r($ this-> input-> post())来查看你在post数组0123中得到了什么 –