I'm trying to get checkbox values and store them in my database. I was following this https://stackoverflow.com/a/29948042/13695248 answer but I always get value 1 in my database, even if it's not checked. I've checked the network tab and it says 'on' for all my checkboxes. This is how one of them look like:
<div class="form-check">
<input type="checkbox" class="form-check-input" id="front-disc-brake" name="front-disc-brake">
<label class="form-check-label" for="front-disc-brake">Front disc brake</label>
</div>
I've tried two methods:
$front_disc_brake = $_POST['front-disc-brake'] ?? 0;
and:
$front_disc_brake = isset($_POST['front-disc-brake']) ? 1 : 0;
but as I said, it's always 1, doesn't matter if I check it or not.