Forums

SAVE checkbox table database

NachoMestre 16 Dec, 2020
hi i am trying to get the checkbox state to be saved to the database by selecting the checkbox.

The problem I have is that when doing the update it only saves in the first row. I cannot make that when selecting another row the array is modified to save the checkbox state.





NAMES ID

- {data:checkbox}

TABLE LIST

- Data1.row:
- Data1.created:Fecha y Hora
- Data1.dni:DNI
- Data1.nombre: Nombre y Apellido
- Data1.area: Area
- Data1.periodo: Periodo
- Data1.archivo_pdf: Archivo

SAVE DATA

- Model: data2
- Data provider:{data:aid}


solution to select the matrix to be able to do the update according to the ID ? to change checkbox state ?

[var] => Array
                (
                    [0] => Array
                        (
                            [Data1] => Array
                                (
                                    [aid] => 33
                                    [user_id] => 0
                                    [created] => 2020-12-14 15:51:22
                                    [modified] => 2020-12-15 16:59:47
                                    [dni] => []
                                    [nombre] => Nacho Mestre 01
                                    [area] => Secretaría de Planificación Urbana
                                    [periodo] => 2020-01
                                    [archivo_pdf] => 35508754Nacho Mestre 01.pdf
                                    [telefono] => 26459682544
                                    [email] => mestrenacho1991@gmail.com
                                    [seleccione_area] => 
                                    [seleccione_periodo] => 
                                    [checkbox] => 
                                    [estado_factura] => 
                                )

                        )

                    [1] => Array
                        (
                            [Data1] => Array
                                (
                                    [aid] => 34
                                    [user_id] => 0
                                    [created] => 2020-12-14 15:52:39
                                    [modified] => 2020-12-15 16:59:47
                                    [dni] => []
                                    [nombre] => Nacho Mestre 02
                                    [area] => Secretaría de Cultura, Turismo y Educación
                                    [periodo] => 2020-10
                                    [archivo_pdf] => 35508754Nacho Mestre 02.pdf
                                    [telefono] => 26459682544
                                    [email] => mestrenacho1991@gmail.com
                                    [seleccione_area] => 
                                    [seleccione_periodo] => 
                                    [checkbox] => 
                                    [estado_factura] => 
                                )

                        )

                    [2] => Array
                        (
                            [Data1] => Array
                                (
                                    [aid] => 35
                                    [user_id] => 0
                                    [created] => 2020-12-14 16:35:25
                                    [modified] => 2020-12-15 16:59:47
                                    [dni] => []
                                    [nombre] => nestor 01
                                    [area] => Secretaría de Gobierno
                                    [periodo] => 2020-01
                                    [archivo_pdf] => 35508754nestor 01.pdf
                                    [telefono] => 26459682544
                                    [email] => mestrenacho1991@gmail.com
                                    [seleccione_area] => 
                                    [seleccione_periodo] => 
                                    [checkbox] => 
                                    [estado_factura] => 
                                )

                        )

                    [3] => Array
                        (
                            [Data1] => Array
                                (
                                    [aid] => 36
                                    [user_id] => 0
                                    [created] => 2020-12-14 16:35:56
                                    [modified] => 2020-12-15 16:59:47
                                    [dni] => []
                                    [nombre] => nestor 02
                                    [area] => Secretaría de Hacienda
                                    [periodo] => 2020-08
                                    [archivo_pdf] => 35508754nestor 02.pdf
                                    [telefono] => 26459682544
                                    [email] => mestrenacho1991@gmail.com
                                    [seleccione_area] => 
                                    [seleccione_periodo] => 
                                    [checkbox] => 
                                    [estado_factura] => 
                                )

                        )

                    [4] => Array
                        (
                            [Data1] => Array
                                (
                                    [aid] => 37
                                    [user_id] => 0
                                    [created] => 2020-12-14 16:41:19
                                    [modified] => 2020-12-15 16:59:47
                                    [dni] => []
                                    [nombre] => nestor 03
                                    [area] => Secretaría de Planificación Urbana
                                    [periodo] => 2020-06
                                    [archivo_pdf] => 35508754nestor 03.pdf
                                    [telefono] => 26459682544
                                    [email] => mestrenacho1991@gmail.com
                                    [seleccione_area] => 
                                    [seleccione_periodo] => 
                                    [checkbox] => 
                                    [estado_factura] => 
                                )

                        )

                    [5] => Array
                        (
                            [Data1] => Array
                                (
                                    [aid] => 38
                                    [user_id] => 0
                                    [created] => 2020-12-16 00:24:39
                                    [modified] => 
                                    [dni] => 35508754
                                    [nombre] => Nacho Mestre 22
                                    [area] => Secretaría de Gobierno
                                    [periodo] => 2020-01
                                    [archivo_pdf] => 35508754Nacho Mestre 22.pdf
                                    [telefono] => 2645038384
                                    [email] => mestrenacho1991@gmail.com
                                    [seleccione_area] => 
                                    [seleccione_periodo] => 
                                    [checkbox] => 
                                    [estado_factura] => 
                                )

                        )

                    [6] => Array
                        (
                            [Data1] => Array
                                (
                                    [aid] => 39
                                    [user_id] => 0
                                    [created] => 2020-12-16 00:30:19
                                    [modified] => 
                                    [dni] => 35508754
                                    [nombre] => Nacho Mestre 33
                                    [area] => Secretaría de Ambiente y Servicio
                                    [periodo] => 2020-01
                                    [archivo_pdf] => 35508754Nacho Mestre 33.pdf
                                    [telefono] => 2645038384
                                    [email] => mestrenacho1991@gmail.com
                                    [seleccione_area] => 
                                    [seleccione_periodo] => 
                                    [checkbox] => 
                                    [estado_factura] => 
                                )

                        )

                    [7] => Array
                        (
                            [Data1] => Array
                                (
                                    [aid] => 40
                                    [user_id] => 0
                                    [created] => 2020-12-16 00:35:42
                                    [modified] => 
                                    [dni] => 35508754
                                    [nombre] => Nacho Mestre 11
                                    [area] => Secretaría de Gobierno
                                    [periodo] => 2020-10
                                    [archivo_pdf] => 35508754Nacho Mestre 11.pdf
                                    [telefono] => 2645038384
                                    [email] => mestrenacho1991@gmail.com
                                    [seleccione_area] => 
                                    [seleccione_periodo] => 
                                    [checkbox] => 
                                    [estado_factura] => 
                                )

                        )

                    [8] => Array
                        (
                            [Data1] => Array
                                (
                                    [aid] => 41
                                    [user_id] => 0
                                    [created] => 2020-12-16 00:56:37
                                    [modified] => 
                                    [dni] => 35508754
                                    [nombre] => Nacho Mestre 44
                                    [area] => Secretaría de Cultura, Turismo y Educación
                                    [periodo] => 2020-01
                                    [archivo_pdf] => 35508754Nacho Mestre 44.pdf
                                    [telefono] => 2645038384
                                    [email] => mestrenacho1991@gmail.com
                                    [seleccione_area] => 
                                    [seleccione_periodo] => 
                                    [checkbox] => 
                                    [estado_factura] => 
                                )

                        )

                )




Debug view database











Max_admin 23 Dec, 2020
Answer
I do not understand your issue, if you want to save multiple rows then you need to run the "Save data" inside a Loop
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
NachoMestre 23 Dec, 2020
save checkbox for array each row with its id.

[3] => Array
                        (
                            [Data1] => Array
                                (
                                    [aid] => 36 ------------------------ SAVE ROW ---------------------
                                    [user_id] => 0
                                    [created] => 2020-12-14 16:35:56
                                    [modified] => 2020-12-16 15:00:03
                                    [dni] => []
                                    [nombre] => nestor 02
                                    [area] => Secretaría de Hacienda
                                    [periodo] => 2020-08
                                    [archivo_pdf] => 35508754nestor 02.pdf
                                    [telefono] => 26459682544
                                    [email] => mestrenacho1991@gmail.com
                                    [seleccione_area] => 
                                    [seleccione_periodo] => 
                                    [estado_factura] => 
                                    [fecha_periodo] => 
                                    [checkbox] =>   ------------- SAVE CHANGE STATUS CHECKBOX ----------------
                                )

                        )

                    [4] => Array 
                        (
                            [Data1] => Array
                                (
                                    [aid] => 37 ------------------- SAVE ROW ------------------
                                    [user_id] => 0
                                    [created] => 2020-12-14 16:41:19
                                    [modified] => 2020-12-16 15:00:03
                                    [dni] => []
                                    [nombre] => nestor 03
                                    [area] => Secretaría de Planificación Urbana
                                    [periodo] => 2020-06
                                    [archivo_pdf] => 35508754nestor 03.pdf
                                    [telefono] => 26459682544
                                    [email] => mestrenacho1991@gmail.com
                                    [seleccione_area] => 
                                    [seleccione_periodo] => 
                                    [estado_factura] => 
                                    [fecha_periodo] => 
                                    [checkbox] => ----------- CHANGE STATUS CHECKBOX ----------------------
                                )

                        )
You need to login to be able to post a reply.