PHP code
$sql = "INSERT INTO user_details (check_box)
VALUES ('$_POST[check_box]')";
Below is my html code
<input type="checkbox" name="check_box[]" value="1"> Group 1<br>
<input type="checkbox" name="check_box[]" value="2"> Group 2<br>
<input type="checkbox" name="check_box[]" value="3"> Group 3<br>
This can be done in this way:
$sql = "INSERT INTO user_details (check_box) VALUES ("
. implode('), (',$_POST[check_box])
. ")";
this is open to mysql injections!! Better do
$clean = array_map('intval',$_POST[check_box]);
before using it.