Assalamualaikum Warahmatullahi Wabarakatuh...
selamat pagi master2. saya buat combox data wilayah ko tidak berhasil.mohon pencerahannya. jadi muncul semua datanya. (File terlampir). sedangkan file js sudah saya simpan di folder sesuai JS nya. (File terlampir). mohon pencerahanya master2.
terima kasih
berikut codingnya.
<?php
//session_start();
//error_reporting(0);
#koneksi ke database
?>
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="<?php echo base_url();?>aset2/js/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>aset2/js/ie-emulation-modes-warning.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>aset2/js/jquery-chained.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>aset2/js/ie10-viewport-bug-workaround.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#kota").chained("#provinsi");
$("#kecamatan").chained("#kota");
});
</script>
</head>
<?php
echo "<div class='col-md-12'>
<div class='box box-info'>
<div class='box-header with-border'>
<h3 class='box-title'>Tambah Data User</h3>
</div>
<div class='box-body'>";
$attributes = array('class'=>'form-horizontal','role'=>'form'); echo form_open_multipart('administrator/tambah_manajemenuser',$attributes);
echo "<div class='col-md-12'>
<table class='table table-condensed table-bordered'>
<tbody>
<tr><th width='120px' scope='row'>Username</th> <td><input type='text' class='form-control' name='a' onkeyup=\"nospaces(this)\" required></td></tr>
<tr><th scope='row'>Password</th> <td><input type='password' class='form-control' name='b' onkeyup=\"nospaces(this)\" required></td></tr>
<tr><th scope='row'>Nama Lengkap</th> <td><input type='text' class='form-control' name='c' required></td></tr>
<tr><th scope='row'>Alamat Email</th> <td><input type='email' class='form-control' name='d' required></td></tr>
<tr><th scope='row'>No Telepon</th> <td><input type='number' class='form-control' name='e' required></td></tr>
<tr><th scope='row'>Provinsi</th> <td><select id='provinsi' class='form-control' name='provinsi'>
<option value=''>Please Select</option>";
$query = mysqli_query($con, "SELECT * FROM provinsi ORDER BY provinsi");
echo "<option value='$row[id_provinsi]'>$row[provinsi] </option>";
}
echo "</select></td></tr>
<tr><th scope='row'>Kota</th> <td><select id='kota' class='form-control' name='kota'>
<option value=''>Please Select</option>";
$query = mysqli_query($con, "SELECT * FROM kota INNER JOIN provinsi ON kota.id_provinsi_fk = provinsi.id_provinsi ORDER BY nama_kota"); echo " <option id='kota' class='$row[id_provinsi]' value='$row[id_kota]'
$row[nama_kota] </option>";
}
echo "</select></td></tr>
<tr><th scope='row'>Kecamatan</th> <td><select id='kecamatan' class='form-control' name='kecamatan'>
<option value=''>Please Select</option>";
$query = mysqli_query($con, "SELECT * FROM kecamatan INNER JOIN kota ON kecamatan.id_kota_fk = kota.id_kota ORDER BY nama_kecamatan"); echo "<option id='kecamatan' class='$row[id_kota]' value='$row[id_kecamatan]'>
$row[nama_kecamatan] </option>";
}
echo " </select></td></tr>
<tr><th scope='row'>Upload Foto</th> <td><input type='file' class='form-control' name='f'></td></tr>
<tr><th scope='row'>Level</th> <td><input type='radio' name='g' value='kontributor' checked> Kontributor <input type='radio' name='g' value='user'> User Biasa <input type='radio' name='g' value='admin'> Administrator
<tr><th scope='row'>Akses Modul</th> <td><div class='checkbox-scroll'>";
foreach ($record as $row){
echo "<span style='display:block'><input name='modul[]' type='checkbox' value='$row[id_modul]' /> $row[nama_modul]</span> ";
}
echo "</div></td></tr>
</tbody>
</table></div>
<div class='box-footer'>
<button type='submit' name='submit' class='btn btn-info'>Tambahkan</button>
<a href='index.php'><button type='button' class='btn btn-default pull-right'>Cancel</button></a>
</div>
</div></div></div>";
echo form_close();