PHP脚本崩溃了IE6

时间:2008-10-10 09:34:49

标签: php html internet-explorer-6

由于某些原因,下面的代码崩溃了IE6。就像IE是可怕的一样,我以前从未见过这个。有没有人有任何想法?

<div id="edit">
<?php 

$a = $_POST['category'];
if ($a == "")
{
    $a = $_GET['category'];
}

$result = mysql_query("SELECT * FROM media WHERE related_page_id = $a && type= 'copy'");

?>

<table width="460px;">
    <tr>
        <td>Item</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>Associated Images</td>
    </tr>
    <tr>
        <td colspan="5">&nbsp;</td>
    </tr>
<?php
while($row = mysql_fetch_array($result))
{
    echo "<tr style='vertical-align:top'><td>$row[title]</td>";
    echo "<td><a href='addimage.php?id=$row[id]&&category=$a'>Add image/file</a>";
    echo "<td><a href='change.php?id=$row[id]&&category=$a'>edit</a></td>";
    echo "<td><a href='delete.php?id=$row[id]&&category=$a'>delete</a></td>";
    echo "<td>";

    $id = $row['id'];
    $result1 = mysql_query("SELECT * FROM media WHERE assets = $id");
    while($row1 = mysql_fetch_array($result1))
    {
        echo "<a href='$row1[path]'>$row1[title]</a> | <a href='delete.php?id=$row1[id]&&category=$a'>remove?</a><br />";
    }
    echo "</td></tr>";
}
if($a == 1 || $a == 3 || $a == 5){
}else{
    echo "<tr><td colspan='5'>&nbsp;</td></tr>";
    echo "<tr><td colspan='5'><a href='change.php?id=0&&category=$a'>New Item</a></td></tr>";
}

?>
</div>
</div>
</div>
</table>
</body>
</html>

3 个答案:

答案 0 :(得分:6)

我不知道是否是崩溃的原因,但行中的td标记

echo "<td><a href='addimage.php?id=$row[id]&&category=$a'>Add image/file</a>";

未关闭。也:

</div>
</div>
</div>
</table>

应该是:

</table>
</div>
</div>
</div>

此外 - 出于安全原因 - 在下面的查询中使用它之前,请检查$a是否为数字。

$a = $_POST['category'];
if ($a == "")
{
        $a = $_GET['category'];
}

$result = mysql_query("SELECT * FROM media WHERE related_page_id = $a && type= 'copy'");

答案 1 :(得分:0)

生成的代码不会让我崩溃IE6。它可能是你的样式表或javascript之一,或者它可能只是我的设置(IE6在这里用作独立的浏览器)。

另外,为什么你有双&符号?您确定不想使用&amp;吗?

答案 2 :(得分:0)

这是生成的代码:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

        <script type="text/javascript" src="../javascript/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript">
        tinyMCE.init({
            mode : "textareas",
            theme : "advanced"
        });
    </script>


    <title>Chapman Corp Site - CMS</title>
    <link rel="stylesheet" href="../css/admin.css" type="text/css" media="screen" title="Chapman" charset="utf-8" />
        <!--[if lte IE 6]> 
<link rel="stylesheet" href="../css/ie6.css" type="text/css" media="screen" />
<script type="text/javascript" src="../javascript/unitpngfix.js"></script>
<![endif]-->

</head>
<body>
<div id="page">
<div id ="content">
<p><a href="index.php">Home</a></p><div id="edit">

<table width="460px;">
    <tr>
        <td>Item</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>

        <td>&nbsp;</td>
        <td>Associated Images</td>
    </tr>
    <tr>
        <td colspan="5">&nbsp;</td>
    </tr>
<tr style='vertical-align:top'><td>Home</td><td><a href='addimage.php?id=77&&category=1'>Add image/file</a><td><a href='change.php?id=77&&category=1'>edit</a></td><td><a href='delete.php?id=77&&category=1'>delete</a></td><td><a href='../uploads/footer.jpg'>footer.jpg</a> | <a href='delete.php?id=88&&category=1'>remove?</a><br /></td></tr></div>

</div>
</div>
</table>
</body>
</html>