Trying to make a dynamic form.
Posted: Fri Sep 10, 2010 7:17 pm
I have 10 sections of a form that have 5 inputs each.
I need to label each set of 5 as a number.
Then post each into all 50 inputs into a database.
My Form:
I need to post each of these 10 sections but I don't know how and I have been trying for literally hours with foreach, for and now I'm down to making it static just for the time being. I haven't encountered something like this before so if you can help please let me know!
I need to label each set of 5 as a number.
Then post each into all 50 inputs into a database.
My Form:
Code: Select all
<form action="inc/frm.php?f=pro_add" method="post">
<table>
<? for ($i=1; $i<=10; $i++){ ?>
<tr>
<td>
<!-- I make a list of products from a mysql db -->
<select id="cat_id" name="cat_id<? echo $i; ?>">
<? while ($pro4_fa = mysql_fetch_assoc($pro4)){ ?>
<option value="<? echo $pro4_fa['cat_id']; ?>"><? echo $pro4_fa['cat_name']; ?></option>
<? } ?>
</select>
<? mysql_data_seek($pro4,0); ?>
</td>
<td><input type="text" class="w95" id="pro_model" name="pro_model<? echo $i; ?>" /></td>
<td><input type="text" class="w95" id="pro_descrip" name="pro_descrip<? echo $i; ?>" /></td>
<td>$ <input type="text" class="w80" id="pro_sell" name="pro_sell<? echo $i; ?>" /></td>
<td class="c"><input type="checkbox" id="tax_id" name="tax_id<? echo $i; ?>" value="1" checked="checked" /></td>
</tr>
<? } ?>
</table>
<input type="submit" value="Save Products" />
</form>