Skip to content
Advertisement

Codeigniter batch update for checkbox

I have a situation like this, I want to update some data where the input are checkboxes, I was tried this code below. Data already saved in database, but data saved in another row,

For example : I checked color red, yellow and grey for BirdA and I checked dark and blue for BirdD at the same time. In database, color for BirdA saved correctly, but for the 2nd bird, dark and blue saved on BirdB (Should be save on BirdD)

I want to solve my problem above, so data should be save in the right place in database. Please check my code below :

My Db Table:

JavaScript

View :

JavaScript

And the controller :

JavaScript

after I execute that code, php has an error like this :

JavaScript

Thank you, Best Regards

Advertisement

Answer

Controller Code:-

JavaScript

Change is in your view code:-

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement