techker Posted November 23, 2013 Share Posted November 23, 2013 Hey guys i have an invoice template the fields are basic..price ,business..... but in the invoice section i have a add field button to add more items..(attached pic.) So how can i insert these extra fields in my database?cause it will insert all in one field.. database:Invoice I_ID Business Client_ID Store Item Description total total_tax Quote Link to comment Share on other sites More sharing options...
techker Posted November 23, 2013 Author Share Posted November 23, 2013 the JS file is $("#addrow").click(function(){ $(".item-row:last").after('<tr class="item-row"><td class="item-name"><div class="delete-wpr"><textarea name="Item">Item Name</textarea><a class="delete" href="javascript:;" title="Remove row">X</a></div></td><td class="description"><textarea name="Description">Description</textarea></td><td><textarea class="cost">$0</textarea></td><td><textarea class="qty">0</textarea></td><td><span class="price">$0</span></td></tr>'); if ($(".delete").length > 0) $(".delete").show(); bind(); }); is there a way to random the textarea name?like item2 description2.... Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted November 23, 2013 Share Posted November 23, 2013 (edited) No. You should name them as item[] and description[] This will make the $_POST['item'] and $_POST['description'] values to be submitted as an array. You just got to simply loop through this array to get the values. Edited November 23, 2013 by Ch0cu3r Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.