Notice: Undefined index: namaunit : <p>I'm new in programming, and i don't know why it doesn't work. I use the same code for my other input form, and that code work just fine. But, for this form, it's not. The form is pretty much same, so, that's why i totally do not understand why it's not working. </p>

<p>This is the php code where the message error come from. I wish you can help me. Thank you so much. </p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
session_start();
require 'db.php';

	$kodeunit = $_SESSION["KodeUnit"];
	$namaunit = $_POST['namaunit'];
	$alamat = $_POST['alamat'];
	$pimpinanunit = $_POST['pimpinanunit'];
	$kuasaanggaran = $_POST['kuasaanggaran'];
	$pembuatkomitmen = $_POST['pembuatkomitmen'];
	$penanggungjawab = $_POST['penanggungjawab'];
	$sql   = "UPDATE unit_organisasi SET Nama_Unit = '$namaunit', Pimpinan_Unit = '$pimpinanunit', Alamat = '$alamat', Kuasa_Anggaran = '$kuasaanggaran', Pembuat_Komitment = '$pembuatkomitmen', Penanggungjawab = '$penanggungjawab' WHERE Kode_Unit = '$kodeunit'";
	
	if((!strlen(trim($namaunit))) || (!strlen(trim($alamat))) || (!strlen(trim($pimpinanunit))) || (!strlen(trim($kuasaanggaran))) || (!strlen(trim($pembuatkomitmen))) || (!strlen(trim($penanggungjawab)))){
		echo "&lt;script&gt;alert('Data Belum Lengkap!')&lt;/script&gt;";
		header ('Location:inpudataunit.php');
	}
	else{
		$result = $conn-&gt;query($sql);
		if($result === TRUE){
			echo "Berhasil diinput";
		}
	}
	
?&gt;</code></pre>
</div>
</div>
</p>
