i want to store the value of a checkbox into my sql database, basically i want to save the default value if it is checked or not.. i am not sure what this would save either true or false?
<div><input type="checkbox" value="Yes" name="chk"/> Yes! I will come!</div>
should I insert into my table like this?
'$_POST[chk]'
Thank you
$_POST[chk]will return the textYes, in your case, if checked, and won’t set it at all if not. Knowing this, you can set the db field how you want, say1or0for tinyint type: