Good afternoon, I have a table with some static and other dynamic data that it retrieves from the BDD as shown below:
Now what I need is to add some radio-type input but in a horizontal way because if I add them vertically I would only allow one of the seven options available throughout the table and what I need is to add an option of the 7 but per user. At the moment the code that I have is the following:
<?php
include 'conexio.php';
/*
$sql = "SELECT * FROM usuarios";
$rs = $conn->query($sql);
*/
$sql = $conn->prepare("SELECT * FROM usuarios");
$sql->execute();
$rs = $sql->fetchAll();
include 'views/asistencia.view.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<table border=1>
<tr>
<th># Empleado</th>
<th>Nombre de Empleado</th>
<th>Asistencia</th>
<th>Retardo</th>
<th>Retardo Justificado</th>
<th>Falta</th>
<th>Falta Justificada</th>
<th>Incapacidad</th>
<th>Cambio de Campaña</th>
<?php foreach ($rs as $resultado): ?>
<tr>
<td><?php echo $resultado['IdTrabajador']; ?></td>
<td><?php echo $resultado['Nombre']; ?></td>
<!--<td><input type="radio" name="r1" id=""></td>
<td><input type="radio" name="r2" id=""></td>
<td><input type="radio" name="r3" id=""></td>
<td><input type="radio" name="r4" id=""></td>
<td><input type="radio" name="r5" id=""></td>
<td><input type="radio" name="r6" id=""></td>
<td><input type="radio" name="r7" id=""></td> -->
</tr>
<?php endforeach; ?>
</table>
</body>
</html>
The objective of my table has to be as follows:
But I have to do only one selection per column and not per row. The problem of adding radio input in this way is that I can only select one per row and not per column as I wish. I hope my explanation was clear.
I hope you can help me with an answer. Thank you very much.