0
So people I have two controllers, sales and sales products, in which in the products sales I select product with checkbox and shipping by a buttom to another page, and in the product controller sales I would have to deal with the array, and it would be sent to sales to show on the screen the products I selected.
View of Productsrelations
<tbody>
<?= $this->Form->create("carrinho", ["class " => "form-add", "action" => "carrinho", "controller" => "Produtos-Vendas"]) ?>
<button type="submit" class="btn-success btn">Carrinho (<span id="additem"></span>)</button>
<?php foreach ($produtos as $produto): ?>
<tr>
<td><?= $this->Number->format($produto->id) ?></td>
<td><?= h($produto->name) ?></td>
<td><?= h($produto->cor) ?></td>
<td><?= h($produto->tecido) ?></td>
<td><?= $this->Number->format($produto->estoque) ?></td>
<td><?= $this->Number->format($produto->preco) ?></td>
<td>
<button type="button" class="btn-success btn addcart">+ Adicionar</button>
<input type="checkbox" style="" name="check[]" class="checkbox" value="<?php echo $produto['id']; ?>">
</td>
</tr>
<?php endforeach; ?>
<?= $this->Form->end() ?>
Controller da Produtovendas
public function carrinho() {
$check = $this->request->getData();
if ($check == null) {
return $this->redirect(['action' => 'index']);
} else {
return $this->redirect(['controller' => 'vendas', 'action' => 'index']);
}
}
My problem is that I don’t know how to treat this $check array so that on the sales screen is displayed the one I selected