php code to display selected row data inside textbox in codeignitter

Wednesday, November 4, 2015

I have a single form for add ,view update and delete.



My page contain table with Edit and delete link.



I need when I click on edit link then it will show the selected row data inside text box.



How can I populate the selected row data and display inside a text box?



This is all in codeIgnitter.



plz see the attached screen shots here for refrence of my view
The code is below:



Controller



public function edit()
{
$id = $this->input->get('id');
$this->db->where('id',$id);
$data['query'] = $this->db->get('categort_tbl');
$data['id'] = $id;
$this->load->view('category', $data);
}

public function select()
{
$data['title'] = "Welcome to DB";
$data['results'] = $this->category_model->getAll();
$this->load->view('category',$data);
}


form and list view
category.php



<form name="frm1" method="post" action="<?php echo base_url(); ?>category/save">

<table height="40px">
<tr>
<td width="9%">Category :</td>
<td width="21%"><input type="text" name="category" required="" size="40" value=""/></td>
<td width="48%"><input type="submit" class="submit_button" name="save" value="Save"/></td>
</tr>

</table>

</form>
</div>





















Category Date Actions
category; ?> created; ?> id,'Edit')?> id,'Delete',array('onclick' => "return confirm('Do you want delete this record')"))?>


0 comments:

Post a Comment