基于搜索,將顯示一個表單,其中包含基于搜索的數據。我想使用搜索結果頁面上的按鈕更新此數據。更新不起作用,當我使用 var dump 時返回空值請幫我查看: <h3> Allowances: </h3><div class='panel panel-info'> <div class='panel panel-heading'></div><?php foreach ($allowance as $data): ?> <div class="form-group"> <?php echo form_label( $data->name); ?> <?php echo form_input(['class' => 'form-control', 'name' => 'amount','value' => $data->amount]); ?> <?php echo form_hidden(['class' => 'form-control', 'name' => 'emp','value' => $data->emp_id]); ?><?php echo form_hidden(['class' => 'form-control', 'name' => 'comp','value' => $data->comp_id]); ?> </div><?php endforeach; ?></div><a href='<?php echo base_url('payroll/update') ?>' class="btn btn-primary" type='submit'> Update</a> COntroller public function update(){ $emp_id = $this->input->get('emp'); $comp_id =$this->input->get('comp'); $d = [ 'amount' =>$this->input->post('amount') ]; $this->payroll_model->update($d,$emp_id,$comp_id); var_dump($d); $this->session->set_flashdata('success','Successfully updated'); }model public function update($d,$emp_id,$comp_id){// $array = array('emp_id'=>$emp_id,'comp_id' =>$comp_id);// $this->db->where($array); $this->db->where('emp_id',$emp_id); $this->db->where('comp_id',$comp_id); $this->db->update('emp_sal',$d); return true;enter code hereenter code hereenter code here
codeIgniter根據搜索更新數據
慕工程0101907
2023-06-24 19:17:11