> I have a form where one option is a dropdown menu. I'd like that menu to > only have items in it that are actually available. Selecting the items with > a query is easy enough but I wondered if anyone could tell me where to start > wit the code.
I dont know what kind of db so I will just use mysql, this comes almost straight from the manual http://us3.php.net/mysql: $query = "SELECT * FROM my_table WHERE available"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); /* Printing results in HTML */ echo "<select name=\"yourDropdownName\">\n"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<option value=\"$line[itemnum]\">$line[itemname]</option>\n"; } echo "</select>\n"; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php