0
Adding Checkbox value to database using php
please can someone help me through this... I want to insert a check box values into a separate field in my database... the check box value is multiple so I want to insert each ticked box inside a separate row..... so I can access it . later with a foreign key. thanks. I get error about array to string conversion whatever.. please help me
1 Answer
+ 1
Give a different name to each checkbox and create a column for each of the checkboxes. Then pass multiple parameters in php where you are using $_POST or get like
$chk1=$_POST['hobby1'];
$chk1=$_POST['hobby1'];
$chk1=$_POST['hobby3'];
After this write an insert query specifying both the parameters of database and that of the form.