I want to write a simple PHP function to insert values of 10 and 20 check boxes. Now, the issue is: should I insert all values in a single column of MySQL table or should I
I put the game name into the brackets and changed their values to true:
After submission this will result in an array like this:
$_POST["games"] = Array ( [Tennis] => true [Cricket] => true [Table] => true )
// all other values false
You can easily store and later manipulate this array if you store it as an JSON string in your database. For that you need a single varchar or text column.
json_encode($_POST["games"])
// {"Tennis":"true","Cricket":"true","Table":"true"}