I seek your help with the following case. I have an HTML table which I load dynamically from mysql, each row of the table has a button with which I intend to take the data of the selected row to another page and collect the data in a form and for this I use a hidden input. The problem I have is that it always brings me the last record of the table to the next page and not the one that I select. This is the code of my table:
<form action="servicio.php" method="post"> <table class="table table-striped"> <thead> <th>Ticket</th> <th>Nombre</th> </thead> <tbody> <?php foreach($consultaTicket as $datos): ?> <tr> <td> <?php echo $datos->getTicket(); ?> </td> <td> <?php echo $datos->getCliente(); ?> </td> <input type="hidden" name="ticket" value="<?php echo $datos->getTicket(); ?>"> <td><input type="submit" class="btn btn-primary btn-sm" value="Seleccionar"></td> <?php endforeach; ?> </tr> </tbody> </table> </form>
Thanks for the help you can give me, I do not know what to do.