I want to update my database entry with an 1 or 0 depends on it is checked or not.
My current code looks like this (only one checkbox, the others are the same just other name):
<form method="post" action="" name="form">
<label class="switch"><input type="checkbox" name="csgo" value="1"><span class="slider"></span></label> CSGO;
<input type="submit" value="Save" class="btn btn-primary" name="submit">
<?php
$csgoac = isset($_POST["csgo"]) ? $_POST["csgo"] : 0;
$sql = "UPDATE Users SET csgoactive='".$csgoac."' WHERE ID='1'";
mysqli_query($db, $sql);
?>
</form>
I tested it with echo $csgoac;
(before the query) and the output was checked = 1
and not checked = 0
.
With the query now, it is only updating "0" to the database, what I did wrong on there?