I have an HTML file that won’t validate and I keep getting the error Line 65, Column 7: document type does not allow element “table” here; missing one of “object”, “applet”, “map”, “iframe”, “button”, “ins”, “del” start-tag
<table><tr>
But my document doesnt have a Line 65, the code is below
<!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>
Validators operate on HTML, not PHP (so compare line numbers to the generated HTML … also note the Show Source option of the W3C validation service).
Paragraphs cannot contain tables. Move the
<table>outside the<p>