I've been developing a dynamically generated form that passes multiple items similar to the sample below to a PHP script.
<div class="menu-item">
<input type="text" value="3" readonly="readonly" class="quantity" name="quantity">
<input type="text" value="Menu Item 3" readonly="readonly" class="item" name="item">
<input type="text" value="80.00" readonly="readonly" class="price" name="price">
</div>
...etc
My issue is because I'm not giving the name attribute for quantity, item and price a unique identifier I'm getting these kinds of parameters passed through to the server side:
quantity=3&item=Menu+Item+3&price=80.00&quantity=2&item=Menu+Item+2&price=50.00&quantity=1&item=Menu+Item+1&price=30.00&total=370.00&name=Alex&table=10&terms=on
I can easily alter it so the names would be quantity1, item1, price1, quantity2, item2, price2, etc but either way I'm not sure how best to loop round those sets of parameters using PHP so I can make sure that I process each quantity, item and price that correspond to an item.
Thanks, Alex