Skip to content
Advertisement

How to insert data using a checkbox inside a while loop php

I want to add the value of a checkbox to the specific row in the database. It adds the value to the wrong rows each time. I tried adding a hidden input with a different value.

JavaScript

Advertisement

Answer

perhaps this might help you understand what I was implying by creating and binding the prepared statements outside the loop.

JavaScript

Without knowing the table schema I could not be sure if the following is correct but based upon the table design shown this appears to work OK.

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