我是关于codeigniter 3的新手, 我的代码有问题请帮忙。
这是我的控制器
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>
我收到了错误 消息:未定义的索引:nik
文件名:controllers / mahasiswa_c.php
行号:48
请帮帮我。
谢谢