Tolong gan apa ada yang salah ? kenapa pas diklik combobox kecamatan, kelurahannya ga muncul ? scriptnya masih salahkah ? terima kasih gan.
<?php
include "../koneksi.php";
?>
<html>
<title>Input Hak Akses Lampid</title>
<link rel="stylesheet" href="../boostrap/css/bootstrap.min.css">
<script src="../js/jquery-2.1.3.min.js" type="text/javascript"></script>
</head>
<body>
<form name="form1" method="post" action="pet_simpan.php">
<div align="center">Data Hak Akses Lampid </div>
<table width="495" border="0" align="center">
<tr>
<td width="131"><div align="left">Nama Petugas </div></td>
<td width="12">:</td>
<td width="338"><label>
<input name="nama_petugas" type="text" id="nama_petugas" maxlength="30" size="30"/>
</label></td>
</tr>
<tr>
<td>NIP</td>
<td>:</td>
<td><label>
<input name="nip" type="text" id="nip" maxlength="18" size="30"/>
</label></td>
</tr>
<tr>
<td>Status</td>
<td>:</td>
<td><label>
<select name="status" >
<option selected>--- Pilih Status ---</option>
<option value="1"> Adb Dinas </option>
<option value="2">Kepala Kasi E-Monev</option>
<option value="3">Registrasi Kecamatan</option>
<option value="4">Registrasi Kelurahan</option>
</select>
</label></td>
</tr>
<tr>
<td>Kecamatan</td>
<td>:</td>
<td><label>
<select name="id_kec" id="id_kec">
<option>--- Pilih Kecamatan ---</option>
<?php
include ('../koneksi.php');
$sql=mysql_query ("select * from kecamatan order by id_kec asc");
while ($row=mysql_fetch_assoc($sql)){
echo"<option value='$row[id_kec]'> $row[nama_kec]</option>";
}
?>
</select>
</label></td>
</tr>
<tr>
<td>Kelurahan</td>
<td>:</td>
<td><label>
<select id="id_kel" name="id_kel">
<option> -Pilih Kelurahan-</option>
<script type="text/javascript">
$(document).ready(function() {
$("#id_kec").change(function(){
var nama_kec=$("#id_kec").val();
$.ajax({
url:"cek_kel.php",
data:"id_kec="+id_kec,
success: function(data){
$("#id_kel").html(data);
}
});
});
});
</script>
</select>
</label></td>
</tr>
<tr>
<td>Username</td>
<td>:</td>
<td><label>
<input name="username" type="text" id="username" maxlength="20" size="30">
</label></td>
</tr>
<tr>
<td>Password</td>
<td> </td>
<td><input type="password" name="password" size="30"></td>
</tr>
<tr>
<td colspan="3"><label>
<div align="center">
<input type="submit" name="Submit" value="Simpan">
<input type="reset" name="Submit2" value="Batal">
</div>
</label></td>
</tr>
</table>
</form>
<script type="text/javascript" src="../boostrap/js/bootstrap.min.js"></script>
</html>
<?php
include ("../koneksi.php");
$id_kel=$_GET['id_kel'];
$sqllagi=mysql_query("SELECT * FROM kelurahan id_kel='$id_kel'");
echo "<option> - Pilih Kelurahan - </option>";
while ($row=mysql_fetch_assoc($sqllagi)){
echo"<option value='$row[id_kel]'> $row[nama_kel]</option>";
}
?>