Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //controler
- function tes(){
- $post = $this->input->post();
- $check = $post['id'];
- $q['data'] = $this->get_db->get_edit($post)->result();
- $q['data_count'] = $this->get_db->get_edit($post)->num_rows();
- $this->load->view('form', $q);
- }
- //-------------------------------
- //model
- function get_edit($post)
- {
- $this->db->select("id, nama, umur, kelas");
- $this->db->from("murid");
- $this->db->where_in('id', $post['id']);
- $this->db->order_by('id', 'DESC');
- $q = $this->db->get();
- return $q;
- }
- //-------------------------------------------------
- //view
- <div class="container">
- <div class="row">
- <h1>Multi CRUD</h1>
- <?=form_open("multi_crud/sunting_proses");?>
- <fieldset>
- <legend><b>Sunting data</b></legend>
- <table cellpadding="5" cellspacing="5">
- <?php
- foreach ($data as $key => $v)
- {
- echo "
- <tr>
- <td><input type='text' name='id[]' value='{$v->id}'></td>
- <td><input type='text' name='nama[]' placeholder='nama' value='{$v->nama}'></td>
- <td><input type='number' name='umur[]' placeholder='umur' value='{$v->umur}' style='width:60px;'></td>
- <td><input type='number' name='kelas[]' placeholder='kelas' value='{$v->kelas}' style='width:60px;'></td>
- </tr>
- ";
- }
- ?>
- </table>
- <br>
- <br>
- <input class="btn btn-info" type="submit" name="sunting" value="Simpan perubahan">
- <input class="btn btn-default" type="reset" value="Reset">
- </fieldset>
- <?=form_close();?>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment