2
I have the following return of Array():
[item] => Array
(
[data_vencimento] => Array
(
[0] => 2016-12-05
[1] => 2016-12-07
[2] => 2016-12-22
)
[itens] => Array
(
[0] => 150,00|1
[1] => 114,00|2
[2] => 85,00|3
)
)
But I need this comeback to go this way:
[item] => Array
(
[0] => Array
(
[data_vencimento] => 2016-12-05
[itens] => 150,00|1
)
[1] => Array
(
[data_vencimento] => 2016-12-07
[itens] => 114,00|2
)
[2] => Array
(
[data_vencimento] => 2016-12-22
[itens] => 85,00|3
)
)
Follows the structure of HTML
<table class="table table-bordered">
<tr>
<th width="50" class="text-center">#</th>
<th>Item do Pacote</th>
<th>Valor</th>
<th>Vencimento</th>
<th width="50" class="text-center"></th>
</tr>
<?php
if(count($pacotes_lista_itens)>0){
foreach($pacotes_lista_itens as $valor){ ?>
<tr>
<td width="50" class="text-center"><?php echo $valor->id; ?></td>
<td><?php echo $valor->nome; ?></td>
<td>R$ <?php echo number_format($valor->valor_venda, "2", ",", "."); ?></td>
<td width="200px">
<input type="date" class="form-control" name="item[data_vencimento][]" id="item[data_vencimento][]" data-id="<?php echo $valor->id; ?>">
</td>
<td width="50" class="text-center"><input type="checkbox" name="item[itens][]" id="item[itens][]" class="checados"value="<?php echo number_format($valor->valor_venda, "2", ",", "."); ?>|<?php echo $valor->id; ?>"></td>
</tr>
<?php
}
} else {
?>
<tr>
<td colspan="5" class="text-center">Nenhum item foi adicionado a este pacote.</td>
</tr>
<?php } ?>
</table>
How do I get this result?
almost that... the only difference is that the items come within a new array, like this one: [0] => Array ( [due date] => 2016-12-06 [items] => Array ( [0] => 150,00|1 ) )
– Sr. André Baill
I believe that if I remove the brackets from the items, it should work... I’ll test :)
– Sr. André Baill
Yeah, sorry, I forgot to take the clasps, I’ve edited!
– JuniorNunes
Perfect @juniorNunes, that’s right, thank you!
– Sr. André Baill