[eluser]Unknown[/eluser]
this is category_controller having three fields cat_id,cat_name,delete_status
function edit_category($cat_id)
{
$css= $this->category_model->get_cat($cat_id);
$data = array(
'cat_id' => $this->input->post('cat_id'),
'cat_name' => $this->input->post('cat_name'),
'delete_status' => $this->input->post('delete_status'),
);
$this->category_model->update_category($cat_id, $data);
$this->data['csss'] = $css;
$data['cat_id']['value'] = $css['cat_id'];
$data['cat_name']['value'] = $css['cat_name'];
$data['delete_status']['value'] = $css['delete_status'];
$this->data['cat_id'] = array(
'name' => 'cat_id',
'id' => 'cat_id',
'type' => 'text',
'style' => 'width:300px;',
//'value' => set_value('cat_id', $css['cat_id']),
);
$this->data['cat_name'] = array(
'name' => 'cat_name',
'id' => 'cat_name',
'type' => 'text',
'style' => 'width:300px;',
);
$this->data['delete_status'] = array(
'name' => 'delete_status',
'id' => 'delete_status',
'type' => 'text',
'style' => 'width:300px;',
);
$this->load->view('edit_category', $this->data);
}
category_model with update function
public function update_category($cat_id, $data)
{
$this->db->where('cat_id', $cat_id);
$this->db->update('saiss_categorymaster', $data);
}
edit_category.php(view)
<?php $this->load->helper('url'); ?>
<?php
$cat_id = $csss['cat_id'];
echo form_open("category/edit/$cat_id");?>
<?php $this->load->helper('form');?>
<?php echo form_input($cat_id);?>
<?php echo form_input($cat_name);?>
<?php echo form_input($delete_status);?>
<input type="submit" name="submit" value="submit"/>
<input type="button" name="btnBack" id="btnBack" value="Back" echo base_url('index.php') ?>/category'" />
<?php echo form_close(); ?>
in this category_controller i got undefined index error i attached the error jpg , kindly help me
and also give me a update data from database code (MVC )