permisi mau nanya. kan saya punya 2 combobox, nah setiap combo boxnya itu menampilkan data dari table yang berbeda. masalahnya disaat dijalankan hanya 1 combo box saja yang aktif dan bisa menampilkan data, tapi combox yang 1 lagi tidak aktif dan gk bisa nampilin data. tolong bantuan nya yaa.
<?php include "koneksi.php" ?>
<?php
$result = mysql_query("select * from sales");
$jsArray = "var slsName = new Array();\n";
echo '<select name="slsId" onchange="changeValue(this.value)">';
echo '<option>Pilih Nama Sales</option>';
while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row['id_sales'] . '">' . $row['nama_sales'] . '</option>';
$jsArray .= "slsName['" . $row['id_sales'] . "'] = {ids:'".addslashes($row['id_sales'])."'};\n";
}
echo '</select>';
?>
<script type="text/javascript">
<?php echo $jsArray; ?>
function changeValue(id){
document.getElementById('sls_id').value = slsName[id].ids;
};
</script>
<input type="text" name="sls_name" id="sls_id"/>
<?php
$result = mysql_query("select * from costumer");
$jsArray = "var prdName = new Array();\n";
echo '<select name="prdId" onchange="changeValue(this.value)">';
echo '<option>Pilih Nama Company</option>';
while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row['id_costumer'] . '">' . $row['nama_costumer'] . '</option>';
$jsArray .= "prdName['" . $row['id_costumer'] . "'] = {att:'".addslashes($row['attention'])."',alt:'" . addslashes($row['alamat']) . "',telp:'" . addslashes($row['telepon']) . "',psot:'".addslashes($row['posisi'])."',id:'".addslashes($row['id_costumer'])."'};\n";
}
echo '</select>';
?>
<script type="text/javascript">
<?php echo $jsArray; ?>
function changeValue(id){
document.getElementById('cst_almt').value = prdName[id].alt;
document.getElementById('cst_atte').value = prdName[id].att;
document.getElementById('cst_telp').value = prdName[id].telp;
document.getElementById('cst_psot').value = prdName[id].psot;
document.getElementById('cst_id').value = prdName[id].id;
};
</script>
<input type="text" name="prod_name" id="cst_almt"/>
<input type="text" name="prod_desc" id="cst_atte"/>
<input type="text" name="prod_name" id="cst_telp"/>
<input type="text" name="prod_desc" id="cst_psot"/>
<input type="text" name="prod_name" id="cst_id"/>
terimakasih sebelumnya