Hallo! Selamat Datang di Marketplace produk digital, Freelancer terbaik di indonesia (68414 Members, 793 Products, 5353 Topic, 13045 Comments)

cara membuat combobox provinsi, kab, kecamatan di modul user swarakalibata

Dibuat
Login Terakhir 20 Hari lalu,
Telah Dilihat 1180 Kali
Kurniawan cyber Mengatakan : Sultan Account
  1. Assalamualaikum Warahmatullahi Wabarakatuh...
  2. 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.
  3. terima kasih
  4.  
  5. berikut codingnya.
  6. <?php
  7. //session_start();
  8. //error_reporting(0);
  9. #koneksi ke database
  10. $con = mysqli_connect("localhost","root","","swarakalibata");
  11. ?>
  12. <!DOCTYPE html>
  13. <html lang="en">
  14. <head>
  15. <script type="text/javascript" src="<?php echo base_url();?>aset2/js/jquery.min.js"></script>
  16. <script type="text/javascript" src="<?php echo base_url();?>aset2/js/ie-emulation-modes-warning.js"></script>
  17. <script type="text/javascript" src="<?php echo base_url();?>aset2/js/jquery-chained.min.js"></script>
  18. <script type="text/javascript" src="<?php echo base_url();?>aset2/js/ie10-viewport-bug-workaround.js"></script>
  19. <script type="text/javascript">
  20. $(document).ready(function() {
  21. $("#kota").chained("#provinsi");
  22. $("#kecamatan").chained("#kota");
  23. });
  24. </script>
  25. </head>
  26.  
  27. <?php
  28. echo "<div class='col-md-12'>
  29. <div class='box box-info'>
  30. <div class='box-header with-border'>
  31. <h3 class='box-title'>Tambah Data User</h3>
  32. </div>
  33. <div class='box-body'>";
  34. $attributes = array('class'=>'form-horizontal','role'=>'form');
  35. echo form_open_multipart('administrator/tambah_manajemenuser',$attributes);
  36. echo "<div class='col-md-12'>
  37. <table class='table table-condensed table-bordered'>
  38. <tbody>
  39. <tr><th width='120px' scope='row'>Username</th> <td><input type='text' class='form-control' name='a' onkeyup=\"nospaces(this)\" required></td></tr>
  40. <tr><th scope='row'>Password</th> <td><input type='password' class='form-control' name='b' onkeyup=\"nospaces(this)\" required></td></tr>
  41. <tr><th scope='row'>Nama Lengkap</th> <td><input type='text' class='form-control' name='c' required></td></tr>
  42. <tr><th scope='row'>Alamat Email</th> <td><input type='email' class='form-control' name='d' required></td></tr>
  43. <tr><th scope='row'>No Telepon</th> <td><input type='number' class='form-control' name='e' required></td></tr>
  44.  
  45. <tr><th scope='row'>Provinsi</th> <td><select id='provinsi' class='form-control' name='provinsi'>
  46. <option value=''>Please Select</option>";
  47.  
  48. $query = mysqli_query($con, "SELECT * FROM provinsi ORDER BY provinsi");
  49. while ($row = mysqli_fetch_array($query)) {
  50.  
  51. echo "<option value='$row[id_provinsi]'>$row[provinsi] </option>";
  52. }
  53. echo "</select></td></tr>
  54. <tr><th scope='row'>Kota</th> <td><select id='kota' class='form-control' name='kota'>
  55. <option value=''>Please Select</option>";
  56.  
  57. $query = mysqli_query($con, "SELECT * FROM kota INNER JOIN provinsi ON kota.id_provinsi_fk = provinsi.id_provinsi ORDER BY nama_kota");
  58. while ($row = mysqli_fetch_array($query)) {
  59. echo " <option id='kota' class='$row[id_provinsi]' value='$row[id_kota]'
  60. $row[nama_kota] </option>";
  61.  
  62. }
  63. echo "</select></td></tr>
  64.  
  65. <tr><th scope='row'>Kecamatan</th> <td><select id='kecamatan' class='form-control' name='kecamatan'>
  66. <option value=''>Please Select</option>";
  67. $query = mysqli_query($con, "SELECT * FROM kecamatan INNER JOIN kota ON kecamatan.id_kota_fk = kota.id_kota ORDER BY nama_kecamatan");
  68. while ($row = mysqli_fetch_array($query)) {
  69. echo "<option id='kecamatan' class='$row[id_kota]' value='$row[id_kecamatan]'>
  70. $row[nama_kecamatan] </option>";
  71.  
  72. }
  73.  
  74.  
  75. echo " </select></td></tr>
  76.  
  77.  
  78.  
  79.  
  80. <tr><th scope='row'>Upload Foto</th> <td><input type='file' class='form-control' name='f'></td></tr>
  81. <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
  82. <tr><th scope='row'>Akses Modul</th> <td><div class='checkbox-scroll'>";
  83. foreach ($record as $row){
  84. echo "<span style='display:block'><input name='modul[]' type='checkbox' value='$row[id_modul]' /> $row[nama_modul]</span> ";
  85. }
  86. echo "</div></td></tr>
  87. </tbody>
  88. </table></div>
  89.  
  90. <div class='box-footer'>
  91. <button type='submit' name='submit' class='btn btn-info'>Tambahkan</button>
  92. <a href='index.php'><button type='button' class='btn btn-default pull-right'>Cancel</button></a>
  93.  
  94. </div>
  95. </div></div></div>";
  96. echo form_close();
  97.  
Ada 3 File Kiriman :
1. masalah1.PNG (16 KB)
2. masalah2.PNG (7 KB)
3. Maaf File 'view_users_tambah.php (0)' Gagal Terkirim!
Maaf, Untuk Memberikan Komentar Anda Harus Login !!!

Online