Search the Community
Showing results for tags 'combobox'.
-
Hello, I have created two tables "category" and "subcategory". So what i need to do is that i have organized two combobox and one will retrieve values from category table and populate the data. However, i need to fill the other combobox when one selected from the category combobox and populate all the values from subcategory table. I really thank you all for helping me out. Looking for great answer. Thank you in advance. Fekade
-
I use firebug to detect how javascript work. It same code. the java script : <script type="text/javascript"> $(function() { $("#cmbNegara").change(function(){ $("img#imgLoad").show(); var kodejeniskayu = $(this).val(); $.ajax({ type: "POST", dataType: "html", url: "getProvinsi.php", data: "kodejeniskayu="+kodejeniskayu, success: function(msg){ if(msg == ''){ $("select#cmbProvinsi").html('<option value="">--Pilih Ukuran--</option>'); $("select#cmbKota").html('<option value="">--Pilih Ukuran--</option>'); }else{ $("select#cmbProvinsi").html(msg); } $("img#imgLoad").hide(); getAjaxAlamat(); } }); }); $("#cmbProvinsi").change(getAjaxAlamat); function getAjaxAlamat(){ $("img#imgLoadMerk").show(); var kodeukuran = $("#cmbProvinsi").val(); $.ajax({ type: "POST", dataType: "html", url: "getKota.php", data: "kodeukuran="+kodeukuran, success: function(msg){ if(msg == ''){ $("select#cmbKota").html('<option value="">--Stok Kosong--</option>'); }else{ $("select#cmbKota").html(msg); } $("img#imgLoadMerk").hide(); } }); }; }); </script> getprovinsi.php <?php require_once('Connections/karyo.php'); ?> <?php ini_set('display_errors',0); //ambil parameter $kodejeniskayu = $_POST['kodejeniskayu']; if($kodejeniskayu == ''){ exit; }else{ $sql ="SELECT kodeukuran,ukuran FROM tukuran WHERE kodejeniskayu='$kodejeniskayu'"; $getNamaProvinsi = mysql_query($sql,$karyo) or die ('Query Gagal'); while($data = mysql_fetch_array($getNamaProvinsi)){ echo '<option value="'.$data['kodeukuran'].'">'.$data['ukuran'].'</option>'; } exit; } ?> getkota.php <?php require_once('Connections/karyo.php'); ?> <?php ini_set('display_errors',0); //ambil parameter $kodeukuran = $_POST['kodeukuran']; if($kodeukuran == ''){ exit; }else{ $sql ="SELECT idstok,harga FROM tstok WHERE kodeukuran = '$kodeukuran'"; $getNamaKota = mysql_query($sql,$karyo) or die ('Query Gagal'); while($data = mysql_fetch_array($getNamaKota)){ echo '<option value="'.$data['idstok'].'">'.$data['harga'].'</option>'; } exit; } ?> the problem at online is, the combobox at getprovinsi not showing up.
-
I am using two tables. "Landlord Table" is a 2 column table. column 1 = "Landlord name" and column 2 ="buildings". "buildings" are set as a primary key. All data from this table is displayed under "Landlord Table" on bottom of page at: http://responsiblyvodka.com/tester.php Problem: I want to add available apartments into a NEW table for potential renters. Instead of searching through all the buildings like I currently have at top in the second combobox. I want to click the landlord name i.e. "ABC" and only have 3 building addresses show up in the combo next to it.