I am trying to insert a single checkbox value into a mySQL database field.
I thought this would be pretty easy, however, I'm finding that is not true. All I want it to do is, if the checkbox is checked, insert a "0" into a mysql table, and if the checkbox IS checked, to insert a "1". It's a single checkbox. I'm using checkboxes because i don't want to use two radio buttons just to portray "yes or no".
Here's the HTML snippet:
<input type="checkbox" id="active" name="active" value="0" />
The above is outputted as a result of a function that checks the database to see if there is a "1" or a "0". So then this is displayed to the user. So in this case, the checkbox un unchecked with a value of "0". What I want to be able to do is check the checkbox, and for it to insert into the database a "1". I want to do this and vise versa. If it is a "1", and I uncheck it, I want to be able to place a "0" into the database.
Getting the current database results is not the problem, it's pushing the changes to the database that are.
Please let me know if you guys need additional info.