if you have many input fields and you want to insert them at once you do:
<input type="email" name="data[email]">
then you insert $_POST['data']
If you want to add many input fields having the same name, using jquery or any Js library, you do this
<input type="email" name="email[]"
Then you loop through it and insert values into Mysql.
My question is: I have both scenarios; I want to insert using
$_POST['data'] because I have many input fields, and I have a page where the user can add multiple input fields. However the following doesn't work
`<input type="email" name="data[email[]]">`
$_POST only has 1 row, the last one, so if the user generates 4 rows, only the last row's input fields values will be in $_POST.
W3 validator says that the whole page is valid, no HTML problems whatsoever.
Basically I'm appending a row of 4 input fields each time the user press add like so
http://jsfiddle.net/jaredwilli/tZPg4/4/
And var_dump($_POST[data]) is only catching the last row. $_POST[data[]) is not valid. If I try to loop through the values I get Warning: Illegal string offset because there's nothing.
Is data[example[]] valid? Or do I have to insert each field individually, not as array?
$_POST?