|
//显示填写表单
public function add(){
$id=$this->uri->segment(4);
$data['id']=$id;
$data['title']=$this->db->select('title')->from('qtype')->where('id',$id)->get()->result_array();
/* echo $data[0]['title']['title'];
p($data);die;*/
$this->load->view('index/add.html',$data);
}
现在根据表单验证情况,没通过返回到add方法中。
public function addpost(){
$id=$this->input->post('id');
$title=$this->input->post('title');
$content=$this->input->post('content');
$address=$this->input->post('address');
//执行表单验证
/*
* 载入验证类
*/
$this->load->library('form_validation');
$this->load->helper('form');
$this->form_validation->set_rules('title','标题','required');
$this->form_validation->set_rules('content','内容','required');
$this->form_validation->set_rules('content','发生地点','required');
if($this->form_validation->run()==FALSE){
$this->add();
}
ID值怎么传过去呢?
|
|