Hello,
Im having trouble adding dynamic input fields into my database. I created a form that has 5 input fields on it:
<tr id="row1">
<td>
<input type="text" name="liquorname_1" id="liquor_name1" />
</td>
<td>
<input type= "text" name="liquortype_1" id="liquor_type1" /></td>
<td>
<input type="text" name="liquorprice_1" id="liquor_price1" />
</td>
<td>
<input type="text" name="mixernotes_1" id="mixer_notes1" />
</td>
<td>
<input type="text" name="liquornotes_1" id="liquor_notes1" />
</td>
<td>
<a href="#" onclick="mooRemove(1);" title="Remove">Remove</a>
</td>
</tr>
After the use has inputted all of their information they have the option to click a button that will add a new line of input fields but are incremented using javascript. name="liquorname_2", "liquortype_2", etc. My goal is to take these inputs and add them to a MySQL database or to create a HTML table that can be inserted into a text row in a database. Right now my output looks like this:
liquorname_1: Bacardi O
liquortype_1: Rum
liquorprice_1: 14.99
mixernotes_1: None
liquornotes_1: Disgusting Liquor
liquorname_2: Bombay Sapphire
liquortype_2: Gin
liquorprice_2: 24.99
mixernotes_2: Gin and Tonic
liquornotes_2: My Favorite Drink
liquorname_3: Ketel One
liquortype_3: Vodka
liquorprice_3: 27.99
mixernotes_3: Vodka Cranberry
liquornotes_3: None
I don't know how to iterate through the array and add each value independently to their respective database row.
I'm not asking for the full code solution just a quick pointer on the functions I should use. Thank you for your time!