Dynamic Dropdown list from MySQL Table

I have a table named “Inventory”
It has a table named “StockMaster”
StockMaster has two columns : “StockID” and “StockItem” (“StockItem” has name of the Stock item)

I want to create a Form with a few input fields for date, quantity of the stock item, Inward/Outward etc, and also having a field with the StockItems from the StockMaster table.
Although the Form is populated with the StockItem (Item name), on form submission the corresponding StockIds should get sent to the script that is processing the submitted data.

I tried a couple of scripts without luck. Please help.

Thanks in advance,


In the previous post, please read “Inventory” as the database name and not Table name.

So… give your <option> tags the value of the stockID’s, but put the names in the display.