0

im new on codeigniter 3 , i have some problem with my code please help .

this my controller

    public function update_data(){
$no_induk = $_POST['nik'];
$nama = $_POST['nama'];
$alamat = $_POST['alamat'];
$data = array(
    'nama' => $nama,
    'alamat' => $alamat
 );
$where = array(
    'no_induk' => $no_induk,
);
$this->load->model('mahasiswa_m');
$res = $this->mahasiswa_m->Update('mahasiswa', $data, $where);
if ($res>0) {
    redirect('mahasiswa_c/index','refresh');
    }

}

<!DOCTYPE html>
<html>

<head>
 <title>Form Edit</title>
</head>

<body>
 <table>
  <form method="post" action="<?php echo base_url()." index.php/mahasiswa_c/update_data "; ?>">
   <tr>
    <td>Nomor Induk</td>
    <td>:</td>
    <td>
     <input type="text" name="nik" disabled placeholder="Masukkan Nomor Induk.." value="<?php echo $no_induk; ?>">
    </td>
   </tr>
   <tr>
    <td>Nama</td>
    <td>:</td>
    <td>
     <input type="text" required name="nama" placeholder="Masukkan Nama Anda.." value="<?php echo $nama; ?>">
    </td>
   </tr>
   <tr>
    <td>Alamat</td>
    <td>:</td>
    <td>
     <textarea style="resize: none;" required name="alamat">
      <?php echo $alamat; ?>
     </textarea>
    </td>
   </tr>
   <tr>
    <td></td>
    <td></td>
    <td>
     <input type="submit" name="submit" value="Update">
    </td>
   </tr>
  </form>
 </table>
</body>

</html>

i got error Message: Undefined index: nik

Filename: controllers/mahasiswa_c.php

Line Number: 48

please help me .

thank you

0 Answers0