I have 2 input types. I have 4 select boxes and 4 checkboxes with hidden fields. The checkboxes have the same name and the select boxes. After submitting, I do this:
var_dump(Input::get(checkboxname));
var_dump(Input::get(selectboxname));
Which outputs:
array(4) {
[1]=> string(5) "value"
[2]=> string(5) "value"
[3]=> string(5) "value"
[4]=> string(5) "value"
}
array(4) {
[0]=> string(5) "value"
[1]=> string(5) "value"
[2]=> string(5) "value"
[3]=> string(5) "value"
}
This is my select box:
<select name="selectboxname[]" >
//values in a complicated for loop that's not important but it works
</select>
This is my checkbox:
<input type='hidden' value='othervalue' name='checkboxname[]'>
<input type="checkbox" name="checkboxname[]" value="value">
In the arrays, the checkboxes have the index like: 1,2,3,4 and the selectboxes have 0,1,2,3. I have to get the indexes to match with eachother. I know normally the index starts at 0 so the selectboxes are doing it right. What is going wrong here?
Aucun commentaire:
Enregistrer un commentaire