I have a table with 4 columns and multiple records. In this same table I have a button for each record.
By clicking this button I would like to take the value of a column and put it in an inputText.
Code:
<input type="text" class="senha">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>Mês/Ano</th>
<th>Senha</th>
<th>Máquina</th>
<th>Validade</th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
while ($linha = $consulta->fetch(PDO::FETCH_ASSOC)) {
$i += 1;
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo mes_extenso($linha['mes']) .'/' .$linha['ano']; ?></td>
<td><?php echo $linha['senha_mensal']; ?></td>
<td><?php echo $linha['nome_maquina']; ?></td>
<td><?php echo date('d/m/Y', strtotime($linha['validade'])); ?></td>
<td class="text-center"><a class='btn btn-info btn-xs'><span class="glyphicon glyphicon-edit"></span> Copiar
<?php $linha['senha_mensal']; ?> </a></td>
<?php } ?>
</tr>
</tbody>
</table>
</div>