0
I am in doubt on how to save a checkbox in the database. How to save a sequence of numbers to know which options have been selected. The last selected option is saved in the current form. Is there any way to save as "1234" or "24" for example to know the options the user has selected?
<div class="row narrow p-0">
<div class="col-12">
<div class="form-group">
<label class="star" for="dias_selecionados">Quais dias deseja?</label><label class="text-danger" > *Somente os dias desejados</label>
<div class="mt-1 py-1 px-2 border border-festival rounded">
<div class="form-check form-check-inline">
<input class="form-check-input m-0" type="checkbox" name="dias_selecionados" id="1" value="1" autocomplete="off"/>
<label class="form-check-label" for="1">dia 1</label>
<?php if (isset($_POST['dias_selecionados']) && $_POST['dias_selecionados'] == '1')?>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input m-0" type="checkbox" name="dias_selecionados" id="2" value="2" autocomplete="off"/>
<label class="form-check-label" for="2">Dia 2</label>
<?php if (isset($_POST['dias_selecionados']) && $_POST['dias_selecionados'] == '2')?>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input m-0" type="checkbox" name="dias_selecionados" id="3" value="3" autocomplete="off"/>
<label class="form-check-label" for="3">Dia 3</label>
<?php if (isset($_POST['dias_selecionados']) && $_POST['dias_selecionados'] == '3')?>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input m-0" type="checkbox" name="dias_selecionados" id="4" value="4" autocomplete="off"/>
<label class="form-check-label" for="4">Dia 4</label>
<?php if (isset($_POST['dias_selecionados']) && $_POST['dias_selecionados'] == '4')?>
</div>
</div>
</div>
</div>
</div>
Evaluate the use of the data type
json
.– anonimo