基于搜索,将显示一个表单,其中包含基于搜索的数据。我想使用搜索结果页面上的按钮更新此数据。更新不起作用,当我使用 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 here
enter code here
enter code here
FFIVE