PROV_ID",""."/> PROV_ID",""."/> PROV_ID","""/>
خرید بک لینک

Vote count: 0

i have this old function that i want to improve in my codes.

view

<td><?php echo anchor("Provinces/update/$i->PROV_ID","<i class='fa fa-trash-o'>" ); ?></td>

controller

public function update(){

    $data['content'] = $this->Provinces_Model->getrow();
    $data['content_view'] = 'Provinces/edit_view';
    $this->templates->admin_template($data);

}

public function update_row(){

    $this->form_validation->set_rules('PROVINCE','Province Name','trim|required|max_length[30]');

    if($this->form_validation->run($this) == FALSE){

        $this->update();
    }else{

        if($this->Provinces_Model->update()){
            redirect('Provinces/index');
        }else{
            $this->update();
        }

    }

}

and lastly the model

public function getrow(){

    $this->db->where('PROV_ID', $this->uri->segment(3));
    $query = $this->db->get($this->table);
    retu $query->row();

}

public function update(){

    $sql = "UPDATE $this->table SET PROVINCE = ? WHERE PROV_ID = ?";
    $input = array(
            'PROVINCE' => $this->input->post('PROVINCE'),
            'PROV_ID' =>$this->uri->segment(3)
            );


    $query =  $this->db->query($sql, $input);
    retu $query;

}

now, i have this data table from an open source. but i dont want to absorb the edit function of this but i want to retain the buttons.. the button code is

<a class="btn btn-sm btn-primary" href="javascript:void(0)" title="Edit" onclick="edit_provinces('."'".$provincce->PROV_ID."'".')"><i class="glyphicon glyphicon-pencil"></i> Edit</a>

how can i make this button code go to the controller function update with its PROVINCE_ID info?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 10 ارديبهشت 1395 ساعت: 12:46

صفحه بندی