saya mau menampilkan data dari tabel jasa, berdasrkan combobox yang ada..saya make method post..disini ada 5 combobox, sebelum dipilih combobox yg awa, combobox selanjutnya nonaktif.. nah jd klo saya cuma pilih beberapa combobox untuk menampilkan data, dia muncul error karena combobox yg nonaktif itu saya panggil method post nya...harusnya seprti apa ya codingannya ??
  1. <!DOCTYPE html>
  2. <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
  3. <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
  4. <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
  5. <!--[if gt IE 8]><!-->
  6. <html class="no-js">
  7. <!--<![endif]-->
  8.  
  9. <head>
  10. <!-- BASICS -->
  11. <meta charset="utf-8">
  12. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  13. <title>Price List</title>
  14. <meta name="description" content="">
  15. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  16. <link rel="stylesheet" type="text/css" href="css/isotope.css" media="screen" />
  17. <link rel="stylesheet" href="js/fancybox/jquery.fancybox.css" type="text/css" media="screen" />
  18. <link rel="stylesheet" href="css/bootstrap.css">
  19. <link rel="stylesheet" href="css/bootstrap-theme.css">
  20. <link rel="stylesheet" href="css/style.css">
  21. <!-- skin -->
  22. <link rel="stylesheet" href="skin/default.css">
  23. <!-- =======================================================
  24. Theme Name: Amoeba
  25. Theme URL: https://bootstrapmade.com/free-one-page-bootstrap-template-amoeba/
  26. Author: BootstrapMade
  27. Author URL: https://bootstrapmade.com
  28. class="navbar-brand"
  29. ======================================================= -->
  30. </head>
  31.  
  32. <body>
  33. <section id="header" class="appear"></section>
  34. <div class="navbar navbar-fixed-top" role="navigation" data-0="line-height:100px; height:100px; background-color:rgba(0,0,0,0.3);" data-300="line-height:60px; height:60px; background-color:rgba(0,0,0,1);">
  35. <div class="container">
  36. <div class="navbar-header">
  37. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
  38. <span class="fa fa-bars color-white"></span>
  39. </button>
  40. <h1><a href="pricelist.php" data-0="line-height:90px;" data-300="line-height:50px;"><i class="fa fa-flask fa-2x mar-bot20"></i> TABELKU
  41. </a></h1>
  42. </div>
  43. <div class="navbar-collapse collapse">
  44. <ul class="nav navbar-nav" data-0="margin-top:20px;" data-300="margin-top:5px;">
  45. <!--<li class="active"><a href="index.html">Home</a></li>
  46. <li><a href="#section-about">About</a></li>
  47. <li><a href="#section-works">Portfolio</a></li>
  48. <li><a href="#section-contact">Contact</a></li>-->
  49. </ul>
  50. </div>
  51. <!--/.navbar-collapse -->
  52. </div>
  53. </div>
  54.  
  55. <section class="featured" color="#000000">
  56. <div class="container" color="#000000">
  57. <div class="row mar-bot40">
  58. <div class="col-md-100 col-md-offset-0">
  59.  
  60. <div class="align-center" margin-left="10px" >
  61. <!--<i class="fa fa-flask fa-5x mar-bot20"></i>
  62. <h2 class="slogan">TABELKU</h2>-->
  63. <p>
  64.  
  65.  
  66. <html>
  67. <?php
  68. // koneksi ke database
  69. //mysql_connect('localhost', 'username', 'password');
  70. //mysql_select_db('belajar');
  71. include "config.php";
  72. ?>
  73. <form method="post">
  74.  
  75. <!--sbu-->
  76. SBU :
  77. <select class='Menu' style="width:200px" id="sbu" name="sbu">
  78. <option value=''>Please Select</option>
  79. <?php
  80. $query = mysqli_query($db, "SELECT * FROM sbu ORDER BY nm_sbu");
  81. while ($row = mysqli_fetch_array($query)) {
  82. ?>
  83. <option value="<?php echo $row['kd_sbu']; ?>">
  84. <?php echo $row['nm_sbu']; ?>
  85. </option>
  86. <?php
  87. }
  88. ?>
  89. </select>
  90.  
  91. <!--bid-->
  92. BIDANG :
  93. <select class='Menu' style="width:200px" id="bid" name="bid">
  94. <option value=''>Please Select</option>
  95. <?php
  96. $query = mysqli_query($db, "SELECT * FROM bid
  97. INNER JOIN sbu ON bid.kd_sbu = sbu.kd_sbu where bid.operasional = 1 ORDER BY nm_bid");
  98. while ($row = mysqli_fetch_array($query)) {
  99. ?>
  100. <option id="kota" class="<?php echo $row['kd_sbu']; ?>" value="<?php echo $row['kd_bid']; ?>">
  101. <?php echo $row['nm_bid']; ?>
  102. </option>
  103. <?php
  104. }
  105. ?>
  106. </select>
  107.  
  108. <!--subbid-->
  109. SUB BIDANG :
  110. <select class='Menu' style="width:200px" id="subbid" name="subbid">
  111. <option value=''>Please Select</option>
  112. <?php
  113. $query = mysqli_query($db, "SELECT * FROM subbid
  114. INNER JOIN bid ON subbid.kd_bid = bid.kd_bid ORDER BY nm_subbid");
  115. while ($row = mysqli_fetch_array($query)) {
  116. ?>
  117. <option id="subbid" class="<?php echo $row['kd_bid']; ?>" value="<?php echo $row['kd_subbid']; ?>">
  118. <?php echo $row['nm_subbid']; ?>
  119. </option>
  120. <?php
  121. }
  122. ?>
  123. </select>
  124.  
  125. <!--gkom-->
  126. GRUP KOMODITI :
  127. <select class='Menu' style="width:200px" id="gkom" name="gkom">
  128. <option value=''>Please Select</option>
  129. <?php
  130. $query = mysqli_query($db, "SELECT * FROM gkom
  131. INNER JOIN subbid ON gkom.kd_subbid = subbid.kd_subbid ORDER BY nm_gkom");
  132. while ($row = mysqli_fetch_array($query)) {
  133. ?>
  134. <option id="gkom" class="<?php echo $row['kd_subbid']; ?>" value="<?php echo $row['kd_gkom']; ?>">
  135. <?php echo $row['nm_gkom']; ?>
  136. </option>
  137. <?php
  138. }
  139. ?>
  140. </select>
  141.  
  142. <!--kom-->
  143. KOMODITI :
  144. <select class='Menu' style="width:200px" id="kom" name="kom">
  145. <option value=''>Please Select</option>
  146. <?php
  147. $query = mysqli_query($db, "SELECT * FROM komoditi
  148. INNER JOIN gkom ON komoditi.kd_gkom = gkom.kd_gkom ORDER BY nm_komoditi_ind");
  149. while ($row = mysqli_fetch_array($query)) {
  150. ?>
  151. <option id="kom" class="<?php echo $row['kd_gkom']; ?>" value="<?php echo $row['kd_komoditi']; ?>">
  152. <?php echo $row['nm_komoditi_ind']; ?>
  153. </option>
  154. <?php
  155. }
  156. ?>
  157. </select>
  158.  
  159. <td>SEARCH :</td>
  160. <td><input class='search' type="text" name="txtsearch" style="width:200px" value="" /> </td>
  161. <td><input class='cari' type="submit" value="Cari" name="submit" style="width:70px"/></td>
  162. <br></br>
  163.  
  164. </form>
  165.  
  166. <script src="jquery-1.10.2.min.js"></script>
  167. <script src="jquery.chained.min.js"></script>
  168. <script>
  169. $("#bid").chained("#sbu");
  170. $("#subbid").chained("#bid");
  171. $("#gkom").chained("#subbid");
  172. $("#kom").chained("#gkom");
  173. //$("#subbid").chained("#kom");
  174. </script>
  175.  
  176.  
  177. <!-- tabel -->
  178.  
  179.  
  180. <?php
  181. if (isset($_POST['submit'])) {
  182. $search = $_POST['txtsearch'];
  183. $sbunya = $_POST['sbu'];
  184. $bidnya = $_POST['bid'];
  185. $subbidnya = $_POST['subbid'];
  186. $gkomnya = $_POST['gkom'];
  187. $komnya = $_POST['kom'];
  188.  
  189.  
  190. if ($bidnya == ''){
  191. if ($search == ''){
  192. $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya'";
  193. } else {
  194. $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and nm_jasa_ind like '%$search%'";
  195. }
  196. } else if ($subbidnya == ''){
  197. if ($search == ''){
  198. $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and kd_bid = '$bidnya'";
  199. } else {
  200. $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and kd_bid = '$bidnya' and nm_jasa_ind like '%$search%'";
  201. }
  202. } else if ($gkomnya == ''){
  203. if ($search == ''){
  204. $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and kd_bid = '$bidnya' and kd_subbid = '$subbidnya'";
  205. } else {
  206. $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and kd_bid = '$bidnya' and kd_subbid = '$subbidnya' and nm_jasa_ind like '%$search%'";
  207. }
  208. } else if ($komnya == ''){
  209. if ($search == ''){
  210. $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and kd_bid = '$bidnya' and kd_subbid = '$subbidnya' and kd_gkom = '$gkomnya'";
  211. } else {
  212. $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and kd_bid = '$bidnya' and kd_subbid = '$subbidnya' and kd_gkom = '$gkomnya' and nm_jasa_ind like '%$search%'";
  213. }
  214. } else {
  215. if ($search == ''){
  216. $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and kd_bid = '$bidnya' and kd_subbid = '$subbidnya' and kd_gkom = '$gkomnya' and kd_komoditi = '$komnya'";
  217. } else {
  218. $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and kd_bid = '$bidnya' and kd_subbid = '$subbidnya' and kd_gkom = '$gkomnya' and kd_komoditi = '$komnya' and nm_jasa_ind like '%$search%'";
  219. }
  220. }
  221.  
  222. $i=1;
  223. $result = mysqli_query($db, $sql) or die('Error, list jasa failed. ' . mysqli_error());
  224.  
  225. if (mysqli_num_rows($result) == 0) {
  226. echo '<p></p><p>Pencarian tidak ditemukan</p>';
  227. } else {
  228. //echo '<p></p>';
  229.  
  230. echo '<table style="table-layout: fixed" border="2" width="1200px">';
  231. echo '<tr><td width="50px">No.</td>';
  232. echo '<td width="600px">Nama Jasa</td>';
  233. echo '<td width="150px">Methode</td>';
  234. echo '<td width="150px">Persyaratan</td>';
  235. echo '<td width="70px">Sat Harga</td>';
  236. echo '<td width="100px">Harga</td></tr>';
  237.  
  238. while ($row = mysqli_fetch_array($result)) {
  239. extract($row);
  240. $harga = $row['hrg'];
  241. $hargaa = number_format($harga,0,',','.');
  242.  
  243. echo '<tr><td align="top">'.$i.'</td>';
  244. echo '<td align="left">'.$nm_jasa_ind.'</td>';
  245. echo '<td align="top">'.$methode.'</td>';
  246. echo '<td align="top">'.$persyaratan.'</td>';
  247. echo '<td align="top">'.$sat_hrg.'</td>';
  248. echo '<td align="right">'.$hargaa.'</td></tr>';
  249. $i++;
  250. }
  251. echo '</table>';
  252. echo '<p></p>';
  253. }
  254. }
  255. ?>
  256. <!--</form>-->
  257.  
  258.  
  259. </p>
  260. </div>
  261. </div>
  262. </div>
  263. </div>
  264. </section>
  265. </body>
  266.  
  267. </html>
15180
Please login to answer!
/sangkep/answer/add-json/nogzip/1
/sangkep/answer/send-notification