Page 1 of 1

want to display dropdown value in a textbox

Posted: Tue Jul 20, 2010 12:27 am
by raj86
hello friends ....i want to display the amount value of the selected drop down list value in a text box..........i m getting the drop down values from the database...........i have 3 fields in consultant table name,number and amount
corresponding amount i have to show in the text box........plz help

Code: Select all

$query="SELECT name,number FROM consultant";
$result = mysql_query ($query);
echo "<select name='number' value=''>Name</option>";
while($nt=mysql_fetch_array($result))
{
$number=$nt['NUMBER'];
echo "$number";
echo "<option value=$nt[number]>$nt[name]</option>";
}
echo "</select>";// Closing of list box 

Code: Select all

[color=#FF0040]
$query1="SELECT amount FROM consultant where NUMBER='$number'";
$result1 = mysql_query ($query1) or die("error in query1");
$amount=$result1['AMOUNT'];
	echo '<td><center>'.$amount.'</td></tr></center>';[/color]