【发布时间】:2012-05-07 19:28:12
【问题描述】:
我有一个无法验证的 HTML 文件,并且我不断收到错误 第 65 行,第 7 列:文档类型不允许此处的元素“表格”;缺少“object”、“applet”、“map”、“iframe”、“button”、“ins”、“del”开始标签之一
<table><tr>
但是我的文档没有第 65 行,代码如下
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="style_2.css"></link>
<title> Gadgets </title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
</head>
<body>
<div class="container">
<div class="background">
<div class="innerContainer">
<?php include("header.php"); ?>
<div class="content">
<div class="scroll">
<?php
error_reporting(0);
$con = mysql_connect("xxxxxxxx");
mysql_select_db("xxxx", $con);
$result = mysql_query("SELECT * FROM gadgets");
?>
<p>
<?php
echo "<table>";
echo "<tr>
<th>Name</th>
<th>Description</th>
<th>Price</th>
<th>Manufacturer</th>
<th>Image</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" .$row['Name']."</td>";
echo "<td>" .$row['Description'] ."</td>";
echo "<td>" .$row['Price'] ."</td>";
echo "<td><img src='" .$row['ImageURL'] ."' style='width: 200px; height: 150px;' alt='Image' /></td>";
echo "</tr>";
}
echo "</table>";
?>
</p>
<?php
mysql_close($con);
?>
</div>
</div>
<?php include("footer.php"); ?>
</div>
</div>
</div>
</body>
</html>
【问题讨论】:
-
错误中的行号引用了生成的 html中的行号。不要查看您的 php 文件 - 在浏览器中查看源代码以识别错误。
标签: php html html-parsing