表格发行(在表格中尽早结束) [英] Form Issue (closing itself early in table)

查看:147
本文介绍了表格发行(在表格中尽早结束)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过mysql数据库上的php运行查询.根据我的结果集,我正在迭代下表:

I'm running a query via php on a mysql database. With my result set I'm am iterating the following table:

        $resultString = '<table>';
        $resultString .= '<tr>';
        $resultString .= '<th>Index</th>';
        $resultString .= '<th>Title</th>';
        $resultString .= '<th>File</th>';
        $resultString .= '<th>Template File</th>';
        $resultString .= '<th>Pretty URL</th>';
        $resultString .= '<th>Parent</th>';
        $resultString .= '<th></th>';
        $resultString .= '</tr>';

        while($data = mysql_fetch_assoc($results)){
            $resultString .= '<form class="myForm">' ."\n";

            $resultString .= '<tr>' ."\n";

            $resultString .= '<input type="hidden" name="index" value="' . $data['index'] . '">' ."\n";
            $resultString .= '<input type="hidden" name="title" value="' . $data['title'] . '">' ."\n";
            $resultString .= '<input type="hidden" name="file_name" value="' . $data['file_name'] . '">' ."\n";
            $resultString .= '<input type="hidden" name="template_file" value="' . $data['template_file'] . '">' ."\n";
            $resultString .= '<input type="hidden" name="child_of" value="' . $data['child_of'] . '">' ."\n";
            $resultString .= '<input type="hidden" name="pretty_url" value="' . $data['pretty_url'] . '">' ."\n";

            $resultString .= '<td class="indexTd">' . $data['index'] . '</td>' ."\n";
            $resultString .= '<td>' . $data['title'] . '</td>' ."\n";
            $resultString .= '<td>' . $data['file_name'] . '</td>' ."\n";
            $resultString .= '<td>' . $data['template_file'] . '</td>' ."\n";
            $resultString .= '<td>' . $data['pretty_url'] . '</td>' ."\n";
            $resultString .= '<td>' . $this->get_parent_select_list($data['child_of'],$data['index']) . '</td>' ."\n";
            $resultString .= '<td class="buttonTd"><input type="button" class="deletePageButton" value="X" onclick="submit_form(this,\'deletePage\')"></td>' ."\n";

            $resultString .= '</tr>' ."\n";

            $resultString .= '</form>' ."\n";
        }

        $resultString .= '</table>';

这张表很棒,唯一的问题是我的表单根本无法使用...在FireBug中查看它,我看到了:

The table comes out great, the only problem is my form isn't working at all... viewing it in FireBug I see this:

该表单正在关闭,因为我所有的输入标签都可以填充它.我曾尝试将标签放在< td>"而不是< tr>"之内....

The form is closing itself becore all of my input tags can populate it. I HAVE tried putting the tags inside a "<td>" instead of a "<tr>" to no avail....

有想法吗?

推荐答案

在另一个标签中打开标签时,打开的标签将在其父标签关闭时关闭.因此:

When you open a tag within another tag, the tag you open will get closed when its parent gets closed. So this:

<p><form></p>
<p></form></p>

将会(或应该)导致:

<p><form></form></p>
<p></p>

您应该在表格上方打开表格,然后在底部将其关闭,从而将整个表格封闭在表格中.

You should open your form above the table and close it at the bottom, thus enclosing the entire table in the form.

在tr,td,thead,tbody,tfoot或th标记之间放置非表格标记是不正确的做法,并且不符合w3c标准

Placing non-table tags between tr,td,thead,tbody,tfoot or th tags is bad practice and not w3c compliant

这篇关于表格发行(在表格中尽早结束)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆