Something basic but I don’t see why it doesn’t work I want to save the state of a checkbox in a database, type Boolean, if checked 1 else 0 here is my code:
<input type="checkbox" name="stok" value="1"
<?php if(isset($_POST['stok'])) echo "checked='checked'"; ?>
/>
<?php
if (isset($_POST['stok']) && !empty($_POST['stok']) && $_POST['stok'] === 'on')
$stok = 1;
else
$stok = 0;
mysql_query ("update tab set etat_vendu=$stok where id=$big");
?>
//this is my var $stok=$row['stok'];