I have this form :
<form>
<select name="data[][]" multiple="multiple">
<option>1</option>
<option selected="selected">2</option>
</select>
<select name="data[][]" multiple="multiple">
<option selected="selected">3</option>
<option>4</option>
</select>
<select name="data[][]" multiple="multiple">
<option selected="selected">5</option>
<option selected="selected">6</option>
</select>
</form>
I would like to get this :
$_POST['data'] = array(
0 => array(2),
1 => array(3),
2 => array(5,6)
);
I instead get this :
$_POST['data'] = array(
0 => array(2),
1 => array(3),
2 => array(5),
3 => array(6)
);
The solution would be to set the index : name="data[0][]" but i want it to be automatically done ..
Any ideas?
One way.Change to :
<select name="data[0][]" multiple="multiple">
...
<select name="data[1][]" multiple="multiple">
...
<select name="data[2][]" multiple="multiple">
Also see @CBroe comment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With