> Hello All, > > I want to fill drop-down box from mysql table, if any body > be kind to tell me a sample code :) > e.g: > In my application i want to gather subject list from current > semester-subject table of a student. > > TIA > -- > Nayyar Ahmad You know that the HTML code for the drop-down is: <SELECT NAME="SAMPLE"> <OPTION VALUE="1">Whatever 1</OPTION> <OPTION VALUE="2">Whatever 2</OPTION> </SELECT> Here's some "pseudo-code" remarks that should help you with your coding: ------------- whatever.html ------------- Drop-down: <SELECT NAME="sample"> <?php // connect to your database - if you haven't already // construct a query to pull the records you want, and // in the order you want to display them // execute the query // loop through the results, building an <OPTION>whatever</OPTION> // for each element in the drop-down. You can get creative // here if you need to. Like: // <OPTION VALUE="##">whatever</OPTION> // where ## is the key field, and whatever is another // (descriptive) field in your query // close your database connection (or later, if needed) ?></SELECT> Try to fill in the actual code yourself. If you get stuck, you can look at: http://www.netmask.com/php-db/sample-dropdown.html Good luck! :Mike S. :Austin TX USA -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php