<?php
echo "
<fieldset>
<legend><b>Form tambah Detail Barang MAsuk</b></legend>
<form name=frm_det method=post action="">
<table>
<tr><td colspan=2><h2 align=left>Tambah barang masuk</h2></td></tr>
<tr><td>No Masuk</td> <td> : <select name=tb_bmasuk onchange=document.getElementById(\'prd_name\').value = prdName[this.value]>;
<option value=0 selected>- Pilih Barang -</option>";
$result=mysql_query("SELECT * FROM tb_bmasuk ORDER BY nomasuk");
$jsArray = "var prdName = new Array();\n";
while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row['nomasuk'] . '">' . $row['nomasuk'] . '</option>';
$jsArray .= "prdName['" . $row['nomasuk'] . "'] = '" . addslashes($row['jml']) . "';\n";
}
echo "</select></td></tr>
<tr><td>Nama Barang</td> <td> : <select name=tb_barang>
<option value=0 selected>- Pilih Barang -</option>";
$tampil=mysql_query("SELECT * FROM tb_barang ORDER BY namabarang");
while($r=mysql_fetch_array($tampil)){
echo "<option value=$r[kdbarang]>$r[namabarang]</option>";
}
echo "</select></td></tr>
<tr><td>jumlah</td><td> : <input type=text name=prd_name id=prd_name ></td></tr>
<tr><td colspan=3><input type=submit value=Simpan>
<input type=reset name=reset value=reset>
<input type=button value=Kembali onclick=JavaScript:timedRedirect()>
</tr>
</table>
</form>
</fieldset>";
pertanyaan saya gmn caranya supaya ketika combobox dengan kode <select name=tb_bmasuk> dipilih maka pada texbox jml itu akan muncul atau keluar valuenya..??? echo "
<fieldset>
<legend><b>Form tambah Detail Barang MAsuk</b></legend>
<form name=frm_det method=post action=\"\">
<table>
<tr><td colspan=2><h2 align=left>Tambah barang masuk</h2></td></tr>
<tr><td>No Masuk</td> <td> : <select name=tb_bmasuk onchange=\"document.getElementById('prd_name').value =prdName[this.value]\">;
<option value=0 selected>- Pilih Barang -</option>";
$result=mysql_query("SELECT * FROM tb_bmasuk ORDER BY nomasuk");
$jsArray = "var prdName = new Array();\n";
while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row['nomasuk'] . '">' . $row['nomasuk'] . '</option>';
$jsArray .= "prdName['" . $row['nomasuk'] . "'] = '" . addslashes($row['jml']) . "';\n";
}
echo "</select></td></tr>
<tr><td>Nama Barang</td> <td> : <select name=tb_barang>
<option value=0 selected>- Pilih Barang -</option>";
$tampil=mysql_query("SELECT * FROM tb_barang ORDER BY namabarang");
while($r=mysql_fetch_array($tampil)){
echo "<option value=$r[kdbarang]>$r[namabarang]</option>";
}
echo "</select></td></tr>
<tr><td>jumlah</td><td> : <input type=text name=\"prd_name\" id=\"prd_name\" ></td></tr>
<tr><td colspan=3><input type=submit value=Simpan>
<input type=reset name=reset value=reset>
<input type=button value=Kembali onclick=JavaScript:timedRedirect()>
</tr>
</table>
</form>
</fieldset>";
echo '<script type="text/javascript">';
echo $jsArray;
echo '</script>';