I have this system where I store checkbox data into an array. So if it is checked it will put the value in the array. Let's say that there are 6 checkboxes, and I check the last 3, then array values [3][4] and [5] will have values, correct? Ok.
Now if the array values [0][1] and [2] are 0 as they haven’t been checked, what is their value?
The question is, that when I do a MySQL insert to a database and I use this code?
mysqli_query($con,"INSERT INTO accounts (chk1, chk2, chk3, chk4, chk5, chk6) VALUES ('$checkbox[0]', '$checkbox[1]', '$checkbox[2]', '$checkbox[3]', '$checkbox[4]', '$checkbox[5]'");
Now, when that query executes, if the first arrays are nothing, it will skip them and pretend they are not there. Is there a way I can make them just put 0 if they haven’t been checked.