0

I need help with the radio button and forms.

Greetings. I need help with the radio button and forms. from my database I bring the data (first and last names). What I need is for the radio to be located next to each name. for more than the attempt is added up or to the sides or under the names, but it is not aligned with the names that come from the form. my code. <?php //realizamos la conexion ////// require_once "conexion.php"; ///////realizamos la consulta///// while ($registroEstudiantes = $consulta_estudiante->fetch_array(MYSQLI_BOTH)) { echo "<tr> <td>".$registroEstudiantes['id_estudiante']."</td> <td>".$registroEstudiantes['nombre_estudiante']."</td> <td>".$registroEstudiantes['apellido_estudiante']."</td> <td>".$registroEstudiantes['curso_estudiante']."</td> </tr>"; } ?>

25th May 2019, 6:13 PM
Alvaro Blanco
Alvaro Blanco - avatar
6 ответов
+ 1
Hello, Please share the troubling code link on your question Description section so people can see, and help you with it. Without a code to look at they can't help you. In case you didn't know how, you can see this post for a how-to. Good luck! https://www.sololearn.com/post/74857/?ref=app
25th May 2019, 6:49 PM
Ipang
+ 1
Alvaro Blanco Can you tell me what the radio buttons are for in this case? I believe you already know how to add a radio button in a table cell, but what you want the buttons do here?
25th May 2019, 7:08 PM
Ipang
+ 1
Alright, but why we need two buttons for first and last name? isn't one button enough to mark a student's presence?
25th May 2019, 7:17 PM
Ipang
+ 1
Alvaro I apologize, I misunderstood you wanted the buttons by the names, my fault. I was thinking, since the students data is presented in a table (multiple records) how do you plan to update the database after the radio button is checked while we have many records in the table. Here is an idea of it using checkbox, put this inside the loop body. I use a string "present-$id" to name the checbox, so each checkbox will have different names. $id = $registroEstudiantes['id_estudiante']; $presence = "present-$id"; echo "<tr><td>$id</td> <td><label>Present <input name='$presence' type='checkbox' value='1'></label> ".$registroEstudiantes['nombre_estudiante']."</td> <td>".$registroEstudiantes['apellido_estudiante']."</td> <td>".$registroEstudiantes['curso_estudiante']."</td> </tr>";
25th May 2019, 8:28 PM
Ipang
0
would be to mark if a student is present or absent in said class.
25th May 2019, 7:10 PM
Alvaro Blanco
Alvaro Blanco - avatar
0
Surname and name in this case are the data collected from the database. the buttons for this example would be *I presented* *Absent*
25th May 2019, 7:19 PM
Alvaro Blanco
Alvaro Blanco - avatar