am new to php. my question is:
i have 5 items in adrop down list box . i have items related to that list in mysql database. i want to list those items in textbox from database when user selects an item from drop down list box.
example;
i have table as follows:
Name Numbers
Sam 042358
dev 785694
dev 34567
fid 345348
i have created list box wic displays name's..
now i have to retrieve the numbers which is stored under those name's..
could anyone give some idea how to do it..
here is d code i did:
<?php
$dbname='test;
$db_user='root';
$db_pass='';
$host='localhost';
$conn = mysql_connect($host, $db_user, $db_pass);
mysql_select_db($dbname);
//$result = mysql_query($query, $connection) or die('Dynamic query function: error making query');
$sql = mysql_query("SELECT distinct Name FROM billing_numbers orderby",$conn);
//echo "connection success";
//$result=mysql_fetch_array($sql);
?>
<select name="Make" onchange="sampledata(this.form.text1);"> <!--((this.selectedIndex == -1) ? null : team[this.selectedIndex-1]));">-->
<?php
while ($row = mysql_fetch_array($sql))
{
?>
<option
<?php
echo $_GET['Name']==$row['Name'] ? 'selected' : '';
?>
>
<?php
echo $row['Name'];
?>
</option>
<?php
}
thanks