samedi 29 août 2015

Bidimensional array of input values

I know that it's possible to store input values in a array when they have the same name like this:

<label>Quantity</label>
<input type="number" name="quantities[]">

<label>Quantity</label>
<input type="number" name="quantities[]">

That would output:

[
    0 => "3"
    1 => "65"
]

But i have to store the item selected with the quantity specified like this:

[
    0 => [
             0 => "38" //item
             1 => "3"  //quantity
         ]
    1 => [
             0 => "799"
             1 => "65"
         ]
] 

How could i do that? Or should i make two different arrays then?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1KTOzhM
via IFTTT

Aucun commentaire:

Enregistrer un commentaire