I am working on a form for my website, I am using Bootstrap 4.2 to create a checkbox system with PHP echo, but it turns out that when I select, for example, in this case, when I select "Test 1" or "Test 2 "is marked" Test 3 "
CODE:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" value="<?php echo $categoria['id']; ?>" class="custom-control-input" id="defaultInline1">
<label class="custom-control-label" for="defaultInline1"><?php echo $categoria['name']; ?></label>
</div>
<?php else: ?>
<div class="custom-control custom-checkbox custom-control-inline">
<input id="defaultInline1" selected value="<?php echo $categoria['id']; ?>" type="checkbox" name="topic_id[]" class="custom-control-input">
<label class="custom-control-label" for="defaultInline1"><?php echo $categoria['name']; ?></label>
</div>
<?php endif; ?>
<?php endforeach; ?>
Aucun commentaire:
Enregistrer un commentaire