简体   繁体   中英

Value save in Database is 0 codeigniter

Can someone please help me to fix my problem here, the codes given below is under MODEL.

My problem is that the value inserted in database is 0 (literally zero) the exact value not shown on the table.

MODEL:

$prcode=$this->input->post('prcode');
$supplier=$this->input->post('supplier');
$data = array('prcode'=>$prcode,'supplier'=>$supplier);
$this->db->insert('t_approved',$data);

CONTROLLER:

$this->ARequestModel->create($data);

VIEW:

<form method = "post">
    <input type="submit"  class="btn green button-submit" onClick = "windows.location <?php echo site_url("ARequest/create");?>" value="Approved">
</form>

Use Code like this

Controller:

function create(){
        $prcode=$this->input->post('prcode');
        $supplier=$this->input->post('sup');
        $data = array(
        'prcode'=>$prcode,
        'supplier'=>$supplier
        );
$this->ARequestModel->create($data);
}

Model:

function create($data){
$this->db->insert('t_approved',$data);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM