duanli6618 2013-02-11 14:29
浏览 38

将值发送到另一个页面

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>";
  • 写回答

1条回答 默认 最新

  • dpwh11290 2013-02-11 14:49
    关注
    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..

    评论

报告相同问题?