Hi!
My MySQL Database Provides A List of Items (and integer IDs with them) in a <select>
and a qty field for usage on my web form (with style display: none
so it is hidden). But: I want the user to be able to select how many choices of this type he wants to enter in the form - how can I dynamically make multiple selects?
Example: The products in the inventory are oranges, bananas and peaches. There is one select tag:
<select name="p[0]">
<option value="2">Orange</option>
<option value="23">Banana</option>
<option value="31">Peach</option>
</select>
QTY <input type="text" name="qty[0]" />
Now I want to add another dropdown allowing the user to chose between ordering one, two or three classes of products. he could choose 2, and then two copies of the above code are inserted into the DOM so he can enter two product choices and quantities. (the Script would give them the names p[0]
and p[1]
etc.)
Can anyone help me here?