mardi 26 avril 2022

How to set checkboxes group with JS, created with PHP [closed]

I'm not sure how to best phrase my question, but here's my problem.

I have an HTML table dynamically created with PHP based on records from a MySQL database. So far, no worries,

In MySQL, each row of this table is linked to another table containing "status".

For example:

Row 1: Chkgrp 1 : Chk 1 = 1, Chk 2 = 0 , Chkgrp 2 : Chk 1 = 1, Chk 2 = 0 etc...

Row 2: Chkgrp 1 Chk 1 = 1, Chk 2 = 1 , Chkgrp 2 : Chk 1 = 1, Value 2 = 0 etc...

Row 2: Chkgrp 1 Chk 0 = 1, Chk 2 = 0 , Chkgrp 2 : Chk 1 = 1, Value 2 = 0 etc...

Etc..

To better express this, here is an image :

Demo

In this example, Row 2 is selected, and below the table, the corresponding checkboxes. If I click on Row 3, I will see below the state of the checkboxes for row 3 etc...

The number of checkbox groups is dynamic based on MySQL records, but for each group, only two checkboxes. I need to be able to modify the value of the checkboxes and to save with a button

I am able to do this, but I don't know how to make it dynamic on a single page, without reloading all the data each time If you have any ideas, could you direct me to the best way to achieve this result?

I'm not asking for complete code, but ideas or suggestions to achieve this.

Thank you for your help




Aucun commentaire:

Enregistrer un commentaire