How to insert multiple check-box values inside database when one or more will be left unchecked?
- by Sally
I have a form that contains 5 check boxes. The user may select one or more of these check boxes. The user may select 2 and leave 3 unchecked or select 4 and leave one unchecked and so on, in that case how can I write the php/mysql code that will insert the form data into the database. With just one selection it's easy, I would do:
$checkbox_value = $_POST['i_agree'];
mysql_query("INSERT INTO terms (user, pass, conditions) VALUES ('$user','$pass','$checkbox_value')");
But how can I write this when there are multiple check box options and only one or more of them will be checked?
I want to insert them all in one column called "tags" separated by commas.