I have a misunderstanding regarding some dynamic row inserts in a MySQL table.
All I want to do is based on the EAV Model:
- I have a products table which contains products
- A attributes table which contains attributes (name) for products (group based - related to category)
- And a product_attribute which contains the value of the attribute
And the user must create this attributes to be associated with a product, and I'm thinking to insert <input> elements with jQuery's append.
But how to track inserts and how to append them to have a specific name : <input name=''>.
The result should do the following:
<form action='attribute_insert.php' method='post'>
<input name='field1' />
<input name='field2' />
<input name='field3' />
....
<input name='field20' />
</form>
and after processing in attribute_insert.php to insert like this :
('1', '12', 'manufacturer');
('2', '12', 'freq');
('3', '12', 'memory');
('4', '12', 'ram');
....
('20', '12', 'blablabla');
How can I do this ... using foreach to scan the $_POST[] or there is a clever method?