i have an html textbox use for searching and when I type on the textbox the field in database will appear as dropdown...pls..help.thanks

pls help me improve this code.. on change, it search the database and the query will be drop down..

<input size="35"  name="supplier" type="text" class="ed"
 value="
 <?php
echo "<select>";
$query = "SELECT * from supplier ORDER BY company ASC";
$result = mysql_query($query);
while ($record = mysql_fetch_array($result)){
 echo "<option>{$record['company']}<option>";
}
echo "</select>"; ?>

You should give a value to option : <option value=\"$record['company']\">$record['company']</option> notice the closing option tag - in your code / is missing.
Plus what is the problem you are facing, you should post that after making the above changes.

i just want to make a search box..when i type anything on the input box, then a dropdown displays data from the database... like a google search box..when you type there is a dropdown related to the search string..

ill try to modify my codes..abovee..thnx

Well in that case your code is completely wrong. You need to use AJAX for this.

ahw..ill study ajax..thank you.

this is what im looking for..thank you for the reference..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.