
hi am not familiar in php.....even though i want to create combobox effectively.... my query is that when i have selected value on combobox which is to be retrieve the relevant data from mysql database using php.... below my code is that..
<html>
<head>
<title>Search the Database</title>
</head>
<body>
<form action="retcombosearch.php"
<method="post">
<select id="inputfield" name="term" size="1">
<option value="">aa </option>
<option value="">bb</option>
<option value="">cc </option>
<option value="">dd </option>
</select>
<input type="submit" name="submit"
value="Submit"/>
</form>
</body>
</html>
retcombosearch.php form is
<?php
mysql_connect ("localhost", "root","root") or
die (mysql_error());
mysql<em>select</em>db ("test");
$term = $_POST['term'];
$sql = mysql_query("select * from testtable
where Fname like '%$term%'");
while ($row = mysql<em>fetch</em>array($sql))
{
echo 'ID:'.$row['ID'];
echo '<br/> First Name: '.$row['Fname'];
echo '<br/> Last Name: '.$row['Lname'];
echo '<br/><br/>';
}
?>
finally the result is whole data is displayed where the data is stored on testtable table. but i need one data alone. i don,t know where to ask. if you know please reply soon. thanks in advance