php - null value for var_dump -
i desired value first var_dump null value both var_dump on submitting form. can me this? precise,i able desired result get->trail->id when form not submitted,but once complete form,and submit it,the value of $id assigned null.
public function trail_cat_cost($trail_unique_code = null) { if($this->userlib->isloggedin()) { $code = $trail_unique_code; $user_id = $this->userlib->getid(); $id = $this->seller_store_model->get_trail_id($code, $user_id); var_dump($id); $choice = $this->input->post("travel_cat"); if(is_null($choice)) { $choice = array(); } $travel_cat = implode(',', $choice); $choice1 = $this->input->post("travel_subcat"); if(is_null($choice1)) { $choice1 = array(); } $travel_subcat = implode(',', $choice1); $trail_currency = $this->input->post('trail_currency'); $trail_cost = $this->input->post('trail_cost'); $cost_valid_from = $this->input->post('cost_valid_from'); $cost_valid_upto = $this->input->post('cost_valid_upto'); //$this->form_validation->set_rules('travel_cat', 'travel category', 'trim|required'); //$this->form_validation->set_rules('travel_subcat', 'travel subcategory', 'trim|required'); $this->form_validation->set_rules('trail_currency', 'trail currency', 'trim|required'); $this->form_validation->set_rules('trail_cost', 'trail cost', 'trim|required'); $this->form_validation->set_rules('cost_valid_from', 'cost valid from', 'trim|required'); $this->form_validation->set_rules('cost_valid_upto', 'cost valid upto', 'trim|required'); if($this->form_validation->run() == false) { $this->load->view('trail_cat_cost'); } else { var_dump($id); $this->seller_store_model->trail_cat_cost($user_id, $id, $travel_cat, $travel_subcat, $trail_currency, $trail_cost, $cost_valid_from, $cost_valid_upto); echo "success"; //redirect('/seller_store/trail_overview/'.$date); } } else { echo "user not authorised"; } }
model code comment
public function get_trail_id($code, $user_id) { $query = $this->db->query("select id trail_basic_info trail_unique_code = '$code' , user_id = '$user_id'"); foreach($query->result() $row) { $id = $row->id; $data = array('trail_id'=>$id); $this->db->update($this->search, $data, array('trail_unique_code'=>$code, 'user_id'=>$user_id)); return $row->id; }
Comments
Post a Comment