salam,
tolong dibantu,,
saya ada problem dengan koding saya,,
saya mau menampilkan data dari pilihan combobox 1 ke :
1. combobox 2 (tampilkan nip) berdasarkan pilihan id mata kuliah (combobox1)????
2.text box (nama mata kuliah) sudah ok.
coding saya sbb :
<h4> Tambah Mata Kuliah </h4>
<form method=post action=?menu=create_makul>
<table border=1>
<tr>
<td> ID Mata Kuliah </td>
<td> : </td>
<td>
<?php
// Koneksi
//mysql_connect("localhost","root","");
//mysql_select_db("db_ebsof");
include "koneksi/koneksi.php";
$result = mysql_query("select * from mak1");
$jsArray = "var prdName = new Array();\n";

echo '<select name="prdId" onchange="changeValue(this.value)">';
echo '<option>
</option>';

while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row . '">' . $row . '</option>';
$jsArray .= "prdName . "'] = {name:'" . addslashes($row) . "',desc:'".addslashes($row)."'};\n";
}
echo '</select>' ;
echo $makul;
?>
</td>
</td>
</tr>
<tr>
<td> Mata Kuliah </td>
<td> : </td>
<td> <input type="text" name="makul" id="makul"/> </td>
</tr>
</td>
</tr>
<tr>
<td> SKS </td>
<td> : </td>
<td> <input type="text" name="sks" id="sks"/> </td>
</tr>

<script type="text/javascript">
<?php echo $jsArray; ?>
function changeValue(id){
document.getElementById('makul').value = prdName[id].name;
document.getElementById('sks').value = prdName[id].desc;
};
</script>

<tr>
<td> Hari </td>
<td> : </td>
<td> <input type=text name=hari maxlength=100> </td>
</tr>
<tr>
<td> Jam Tayang </td>
<td> : </td>
<?
$gula=date('H:i');
$gula1=time('h:m:s');
?>
<td> <input type=text name=gula value= <?php echo "$gula"; ?>></td>

</tr>
<tr>
<td> Pengajar </td>
<td> : </td>
<td> <select name=id_pengajar>
<?php
$makul = $_GET;
include "koneksi/koneksi.php";
$sql = mysql_query("select nip from mak where makul='$makul' order by nip");
while ($data = mysql_fetch_array($sql)){
echo "<option value='$data[nip]'> $data[nip] </option>";
}
?>
</select>
</td>
</tr>
<tr>
<td colspan=3> <input type=submit value=Simpan> <input type=submit value=Batal onClick=history.back()> </td>
</tr>
</table>
</form>
Silahkan login untuk menjawab!