Hi
I'm building an app in CodeIgniter. I have an invoice form which uses jQuery to create new line items. The line items are formated as follows:
<input type="text" name="invoice[new_item_attributes][][description]" class="ui-corner-all text invDesc" title="Description" />
<input type="text" name="invoice[new_item_attributes][][qty]" class="ui-corner-all text invQty" title="Qty" />
<input type="text" name="invoice[new_item_attributes][][amount]" class="ui-corner-all text invAmount" title="Amount" onChange="CalculateTotal(this.form)" />
<input type="hidden" name="invoice[new_item_attributes][][rowTotal]" class="row-total-input" />
What I can't work out is how can I loop through multiple line items to store then in a DB called line items.
At the moment i have
foreach ( $_POST['invoice'] as $key => $value)
{
$data = array(
'description' => $value;
);
}
But I know that can't be write because I need to somehow reference the *invoice[new_item_attributes][][description]* to store it in description etc...
Any help would be greatly appreciated.