I have a value of a checkbox saved in the database (table = way, field = active, values 1 = Active, 0 = Inactive, Boolean field), but when the form needs to be updated and opened, it does not show the check marked, always leaves it unmarked.
My code is as follows:
<div class="col-md-6 col-sm-6 col-xs-12 form-group has-feedback">
<label class="control-label col-md-push-12 col-sm-12 col-xs-12">
<div class="checkbox">
<label>
<?php
$sqlprueba = mysqli_query($con, "SELECT * FROM way");
$row = mysqli_fetch_assoc($sqlprueba);
$check = $row['active'];
if ($check == 1) {
echo " checked";
} else {
echo "";
}
?>
<input type = "checkbox" name = "mod_active" value = "<?php echo $row['active']; ?>"<?php echo $check;
?>Activo <?php echo $row['active']; ?>
</label>
</div>
</div>