jestem na etapie tworzenia pewnej funkcjonalności. Kod HTML wygląda w ten sposób:
<div class="wz_details_bottom"> Ilość palet: <input type="wz" class="required" size="10" name="obiekt['<?php echo $values['order_id']; ?>']['1']['ilosc_palet'][]" class="required number" placeholder="Ilość palet" /> Ilość palet: <input type="wz" size="10" name="obiekt['<?php echo $values['order_id']; ?>']['2']['ilosc_palet'][]" placeholder="Ilość palet" /> Ilość palet: <input type="wz" size="10" name="obiekt['<?php echo $values['order_id']; ?>']['3']['ilosc_palet'][]" placeholder="Ilość palet" /> Ilość palet: <input type="wz" size="10" name="obiekt['<?php echo $values['order_id']; ?>']['4']['ilosc_palet'][]" placeholder="Ilość palet" /> Ilość sztuk: <input type="wz" size="10" name="obiekt['<?php echo $values['order_id']; ?>']['4']['ilosc_sztuk'][]" placeholder="Ilość sztuk" /> </div>
Tak przygotowany kod generuje mi tablicę tego typu
array(3) { ["'27'"]=> array(4) { ["'1'"]=> array(2) { ["'ilosc_palet'"]=> array(1) { [0]=> string(2) "10" } ["'ilosc_sztuk'"]=> array(1) { [0]=> string(2) "11" } } ["'2'"]=> array(2) { ["'ilosc_palet'"]=> array(1) { [0]=> string(2) "10" } ["'ilosc_sztuk'"]=> array(1) { [0]=> string(2) "11" } } ["'3'"]=> array(2) { ["'ilosc_palet'"]=> array(1) { [0]=> string(2) "10" } ["'ilosc_sztuk'"]=> array(1) { [0]=> string(2) "11" } } ["'4'"]=> array(2) { ["'ilosc_palet'"]=> array(1) { [0]=> string(0) "" } ["'ilosc_sztuk'"]=> array(1) { [0]=> string(0) "" } } } ["'28'"]=> array(4) { ["'1'"]=> array(2) { ["'ilosc_palet'"]=> array(1) { [0]=> string(2) "12" } ["'ilosc_sztuk'"]=> array(1) { [0]=> string(2) "13" } } ["'2'"]=> array(2) { ["'ilosc_palet'"]=> array(1) { [0]=> string(0) "" } ["'ilosc_sztuk'"]=> array(1) { [0]=> string(0) "" } } ["'3'"]=> array(2) { ["'ilosc_palet'"]=> array(1) { [0]=> string(0) "" } ["'ilosc_sztuk'"]=> array(1) { [0]=> string(0) "" } } ["'4'"]=> array(2) { ["'ilosc_palet'"]=> array(1) { [0]=> string(0) "" } ["'ilosc_sztuk'"]=> array(1) { [0]=> string(0) "" } } } ["'29'"]=> array(4) { ["'1'"]=> array(2) { ["'ilosc_palet'"]=> array(1) { [0]=> string(2) "14" } ["'ilosc_sztuk'"]=> array(1) { [0]=> string(2) "15" } } ["'2'"]=> array(2) { ["'ilosc_palet'"]=> array(1) { [0]=> string(0) "" } ["'ilosc_sztuk'"]=> array(1) { [0]=> string(0) "" } } ["'3'"]=> array(2) { ["'ilosc_palet'"]=> array(1) { [0]=> string(0) "" } ["'ilosc_sztuk'"]=> array(1) { [0]=> string(0) "" } } ["'4'"]=> array(2) { ["'ilosc_palet'"]=> array(1) { [0]=> string(0) "" } ["'ilosc_sztuk'"]=> array(1) { [0]=> string(0) "" } } } }
Nie do końca przyjazne i przede wszystkim czytelne jest operowanie na tego typu polach - biorąc przede wszystkim pod uwagę, że w późniejszym etapie będę potrzebował wymnożyć przez siebie pary liczb ilosc_paletp[x] * ilosc_szt[x]. Dodatkowo potrzebuję też wyciągnąć pierwszą i główną wartość tabeli, w tym przypadku "27", "28", "29" - co odpowiada za ID. Czy ktoś mógłby podsunąć pomysł, na rozwiązanie mojego problemu?
Pozdrawiam.