I created a table to show the search results, each row the table is a link and the links have a hidden form with a javascript to send the id to another php page, but the problem is when I click one of this links, the form only sends the first id the sql table. After all What's wrong ?
while ($row = $stmt->fetch()) {
echo("<form id=id_form method=post action=lp_search_system_2.php>
<input type=hidden name=id value=".$row['id_np_outdoor'].">
</form>");
echo ' <tr align="left" class="simple">
<td><a href="#" onclick="id_form.submit()">' . $row['nome'] . '</a></td>
<td><a href="#" onclick="id_form.submit()">' . $row['sobrenome'] . '</a></td>
<td><a href="#" onclick="id_form.submit()">' . $row['tipo'] . '</a></td>
<td><a href="#" onclick="id_form.submit()">' . $row['estado'] . '</a></td>
<td><a href="#" onclick="id_form.submit()">' . $row['país'] . '</a></td>
</tr>
';
}
echo "</table>";
while ($row = $stmt->fetch()) {
echo "<form id=id_form".$row['id or something'] method=post action=lp_search_system_2.php>";
echo "<input type=hidden name=id value=".$row['id_np_outdoor'].">";
echo "</form>";
:
:
:
as you have made it.
Remember, you will also have to submit the respective form for each row. So, change onclick code too..