I have to make a basic form included in a table send a certain value to then be able to delete the row, but I am not able to do so.
This is a table with users, keys and delete buttons (which I use as submit). The idea is that when I press one of them I keep the variable $ cont as the row number I am in, but it always returns me or the first one, if I use at the beginning $ cont = 0, or the last one, if I use $ cont = 1 Is there any way I can save the row in which the specific button is?
I attach code.
echo "<table align='center'><form action='' method='post'>
<tr><th>USUARIO</th><th colspan='2'>CLAVE ENCRIPTADA</th>";
$cont=0;
foreach ($usuarios as $clave=>$valor) {
echo "<tr>";
echo "<td>".$usuarios[$clave]."</td>";
echo "<td>".$pswds[$clave]."</td>";
echo "<td>".$cont."</td>";
echo "<input type='hidden' name='cont' value='".$cont."'>";
echo "<td><input type='submit' name='borrar' value='BORRAR' id='enviar'/></td>";
$cont++;
}
echo "</form></table>";