Adding Checkbox value to database using php | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

9th Apr 2017, 3:31 PM
Master Wayne
Master Wayne - avatar
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.
15th Apr 2017, 10:44 AM
ABDUL MANAN
ABDUL MANAN - avatar