Well you can probably do this with the count() in your query. I am not totaly sure about your DB Tables so Ill try and improvise.
select coun(flavor) from products where product_number = X
this will tell me how many flavors product X has
Again without totaly knowing your Table Structre, you probably can do this with one Query
If you only have one table setup like
ProductName, ProductNumber, Flavor, Color, Sent
then all you have to do is select * from table where productNumber = X
This is NOT the best design...
To eliminate the blank dropdowns you can always populate some arrays, then use php to see if you need to display the <select> HTML.
Hope this helps... Let me know if I can be of more help...
PHPdev