When I try to check the database if any registry exists, check the checkbox as checked, it always returns me as not checked.
<?php
$result_cat = $conexao->prepare("SELECT * FROM colecoes WHERE activo = :activo");
$result_cat->bindValue(':activo', 1, PDO::PARAM_INT);
$result_cat->execute();
$row_cat_l = $result_cat->fetchAll(PDO::FETCH_OBJ);
$qtd = count($_REQUEST['categorias_estabelecimentos']);
for ( $i = 0; $i < $qtd ; $i++ ) {
$cat = $_REQUEST['categorias_estabelecimentos'];
}
foreach ($row_cat_l as $row_cat) {
?>
<label class='checkbox inline'>
<input type="checkbox" <?=(in_array($row_cat->slug, $cat)?'checked="checked"':NULL)?> name="categoria[]" value="<? $row_cat->slug; ?>" />
<?= $row_cat->titulo; ?>
</label>
<?php
}
?>