want to display dropdown value in a textbox

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
raj86
Forum Commoner
Posts: 25
Joined: Tue Sep 29, 2009 12:28 am

want to display dropdown value in a textbox

Post 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]
Post Reply