I have the same problem as above and i tried to modified my codes according to what solution others have given but it won't work. I've tried for a few days already. I'm using dreamweaver cs3 to build my site and I'm new to php, js and others. I'm not sure if my codes failed because I'm using dreamweaver app to retrieve data from mysql.

I need to populate my 3 text field when I select an item from the drop down menu. I managed to populate the drop down menu from table in mysql, I can't even get one text field right..

This is the condition :
SelectDropDown = Course Code(Kod_Kursus)
TextField1 = CourseName(Nama_Kursus)
TextField2 = TimeCreditTheory(Jam_Kredit_Teori)
TextField3 = TimeCreditPractical(Jam_Kredit_Amali)

#retrieve from mysql by dreamweaver
<?php require_once('Connections/mysql.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

mysql_select_db($database_mysql, $mysql);
$query_ListCourse = "SELECT * FROM kursus";
$ListCourse = mysql_query($query_ListCourse, $mysql) or die(mysql_error());
$row_ListCourse = mysql_fetch_assoc($ListCourse);
$totalRows_ListCourse = mysql_num_rows($ListCourse);
?><html>
<head><title>Course Listing</title>

#follow the instructions in forums
<script type="text/javascript">
function Choice() {
x = document.getElementById("Nama_Kursus");
y = document.getElementById("Kod_Kursus");

x.value = y.options[y.selectedIndex].text;
}

</script>
</head><body>
<form name ="form1" Method ="POST" Action ="">
Code :
<select name="Kod_Kursus" id="Kod_Kursus" onChange='Choice();'>
<option value="">-pilih kod kursus-</option>
<?php
do {
?>
<option value="<?php echo $row_ListCourse['Kod_Kursus']?>"><?php echo $row_ListCourse['Kod_Kursus']?></option>
<?php
} while ($row_ListCourse = mysql_fetch_assoc($ListCourse));
$rows = mysql_num_rows($ListCourse);
if($rows > 0) {
mysql_data_seek($ListCourse, 0);
$row_ListCourse = mysql_fetch_assoc($ListCourse);
}
?>

</select> <br>

Courses name :

<input type="text" name="Nama_Kursus" id="Nama_Kursus"> <br>

# can't even get the 1st text field right..so as this two below
Time Credit (theory) :

<input name="Jam_kredit_Teori" type="text" id="Jam_Kredit_Teori" size="3">

Time Credit (Practical) :

<input name="Jam_Kredit_Amali" type="text" id="Jam_Kredit_Amali" size="3">


</form>
</body>
</html>
<?php
mysql_free_result($ListCourse);
?>

help me plss...