syazyan
12-15-2006, 02:04 AM
hello there,
i need help from anyone who could help me to solve this problem. i have a drop down that had a list from the database. which means that i list down the data from the database. i need to populate a textfield based on the user selection from the drop down list.
i had a code which can do the work,but the problem is the selection from the drop down list will not be stored into a database. only the value from the textfield will be stored...
can anyone help me to slve this problem??:confused:
//javascript function
<script language='javascript'>
function move(s)
{
document.form1.grpval.value = s;
}
</script>
//database
mysql_select_db('customs', $dbConn);
$query = "SELECT * FROM address WHERE name <> add1 <> add2 <> add3";
$Recordset1 = mysql_query($query) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_select_db('customs', $dbConn);
$query2 = "SELECT add1,add2,add3 FROM address WHERE add1 <> name";
$Recordset2 = mysql_query($query2) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
//drop down
<select name="description" onChange="move(this.value);" id = "description">
<?php
do {
?>
<option value="<?php echo $row_Recordset3['grpval']?>"><?php echo $row_Recordset3['description']?> <?php echo $row_Recordset3['amount']?></option>
<?php
} while ($row_Recordset3 = mysql_fetch_assoc($Recordset3));
$rows = mysql_num_rows($Recordset3);
if($rows > 0) {
mysql_data_seek($Recordset3, 0);
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
}
?>
</select>
//textfield
<input name="grpval" type="text" class="style3" id="grpval" size="10" readonly>
i need help from anyone who could help me to solve this problem. i have a drop down that had a list from the database. which means that i list down the data from the database. i need to populate a textfield based on the user selection from the drop down list.
i had a code which can do the work,but the problem is the selection from the drop down list will not be stored into a database. only the value from the textfield will be stored...
can anyone help me to slve this problem??:confused:
//javascript function
<script language='javascript'>
function move(s)
{
document.form1.grpval.value = s;
}
</script>
//database
mysql_select_db('customs', $dbConn);
$query = "SELECT * FROM address WHERE name <> add1 <> add2 <> add3";
$Recordset1 = mysql_query($query) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_select_db('customs', $dbConn);
$query2 = "SELECT add1,add2,add3 FROM address WHERE add1 <> name";
$Recordset2 = mysql_query($query2) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
//drop down
<select name="description" onChange="move(this.value);" id = "description">
<?php
do {
?>
<option value="<?php echo $row_Recordset3['grpval']?>"><?php echo $row_Recordset3['description']?> <?php echo $row_Recordset3['amount']?></option>
<?php
} while ($row_Recordset3 = mysql_fetch_assoc($Recordset3));
$rows = mysql_num_rows($Recordset3);
if($rows > 0) {
mysql_data_seek($Recordset3, 0);
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
}
?>
</select>
//textfield
<input name="grpval" type="text" class="style3" id="grpval" size="10" readonly>