I am using Jquery dynamic form plugin to generate dynamic fields in one of the forms I have in the application. the plugin works fine and it creates the field. I am still confused on what the best way is to get the form field values.
foreach ($this->input->post('product_item') as $key => $value) {
foreach($value as $element)
{
print_r($element);
}
}
returns
Array ( [color0] => red [size0] => s [quantity0] => 2 ) Array ( [color0] => green [size0] => m [quantity0] => 2 )
How do I get specific array value to store it in the Database.for e.g access Array ( [color0] => red [size0] => s [quantity0] => 2 ) and store it’s value in Database.
Thanks for your time.
By looking at this, you already know how to get the field values, just continue to recurse the array.
Would this not get you the desired result:
}
In your example, you have the array keys in both arrays end in
0, these should increment, right?