2012-05-07 67 views
-2

我有一个HTML文件,将不会验证,我不断收到错误行65,列7:文档类型不允许元素“表”在这里;失踪“对象”,“小程序”,“地图”,“IFRAME”,“按钮”,“项”,“德尔”的一个开始标记 <table><tr>Html验证PHP

但我的文档可是没有一个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> 
+1

您是否读过错误? – SLaks

+4

错误中的行号引用**生成的** html中的行号。不要看你的php文件 - 在你的浏览器中查看源代码来识别错误。 –

回答

4

确认者对HTML进行操作,而不是PHP(所以行号比较生成的HTML ...还要注意W3C验证服务的显示源代码选项)。

段落不能包含表格。将<table>移到<p>以外

+0

谢谢@Quetin,你刚刚度过了我的一天 –