HTML表单不起作用

时间:2015-04-18 11:26:40

标签: php

抱歉,我有一些问题。 在编辑器中,我编码像这样

<?php while($rs = mysql_fetch_array($qr)) { ?>
    <form action="admin_search_save.php" method="POST">
        <tr>
            <td><?=$rs['firstname'].' '.$rs['lastname']?></td>
            <td><?=$rs['schoolof_id']?></td>
            <td><?=$rs['major_id']?></td>

            <input type="hidden" id="update" value="<?=$rs['id']?>">
            <td>
                <input type="text" name="studentid" id="studentid" placeholder="กรอกรหัสนักศึกษา" class="form-control" />
            </td>
            <td>
                <select name="status" id="status" class="form-control">
                    <option value="">เลือก</option>
                    <option value="true">ชำระแล้ว</option>
                    <option value="false">ยังไม่ได้ชำระ</option>
                </select>
            </td>
            <td>
                <button type="submit" class="btn btn-primary">
                    <i class="glyphicon glyphicon-check"> </i>
                </button>
            </td>
        </tr>
    </form>
<?php } ?>

但在chrome的控制台元素中,代码显示如下 enter image description here

为什么不相关? 我很困惑。

1 个答案:

答案 0 :(得分:2)

因为你忘了在tr

之前添加表格标签
     <?php while($rs = mysql_fetch_array($qr)) { ?>
            <form action="admin_search_save.php" method="POST">
                <table>
                 <tr>
                    <td><?=$rs['firstname'].' '.$rs['lastname']?></td>
                    <td><?=$rs['schoolof_id']?></td>
                    <td><?=$rs['major_id']?></td>

                    <input type="hidden" id="update" value="<?=$rs['id']?>">
                    <td>
                        <input type="text" name="studentid" id="studentid" placeholder="กรอกรหัสนักศึกษา" class="form-control" />
                    </td>
                    <td>
                        <select name="status" id="status" class="form-control">
                            <option value="">เลือก</option>
                            <option value="true">ชำระแล้ว</option>
                            <option value="false">ยังไม่ได้ชำระ</option>
                        </select>
                    </td>
                    <td>
                        <button type="submit" class="btn btn-primary">
                            <i class="glyphicon glyphicon-check"> </i>
                             บันทึก
                        </button>
                    </td>
                </tr>
             </table>
            </form>
        <?php } ?>