phphtmlxhtml-1.0-strictxhtml

I cannot understand this error in XHTML strict


This page is generated through a PHP script. Here is the error message:

Line 14, Column 8: end tag for "tbody" which is not finished

</tbody></table>

Most likely, you nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p>

Another possibility is that you used an element which requires a child element that you did not include. Hence the parent element is "not finished", not complete. For instance, in HTML the <head> element must contain a <title> child element, lists require appropriate list items (<ul> and <ol> require <li>; requires <dt> and <dd>), and so on.

Here is what my code looks like when you view source in Google Chrome:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title></title> 
    <link href="CSS/Index.css" rel="stylesheet" type="text/css" /> 
</head> 
<body> 
<h3>Search Results</h3> 
<table> 
<tbody> 
</tbody></table> 
</body> 
</html>

Here is what my code looks like when you view source in Firefox:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>PcDescribeTable</title>
<link href="CSS/Index.css" rel="stylesheet" type="text/css" /> 
</head>
<body>
<h3>Search Results</h3>
<table>
<tr><td>Intel i7-950 3.06GHz</td></tr>
<tr><td>WD 500GB 7200RPM SATA 6GBs</td></tr>
<tr><td>XFX Radeon HD 6870</td></tr>
<tr><td>CORSAIR 4GB DDR3 1600</td></tr>
<tr><td>ASUS P6X58D-E LGA 1366</td></tr>
<tr><td>CORSAIR Enthusiast Series 650W</td></tr>
<tr><td>VisonTek Bigfoot Killer</td></tr>
<tr><td>Creative Sound Blaster X-Fi HD</td></tr>
<tr><td>Razer Lycrosa</td></tr>
<tr><td>24x DVD Burner</td></tr>
<tr><td>Asus 23" Full HD LED</td></tr>
<tr><td>Razer Death Adder</td></tr>
</table>
</body>
</html>

And this is what the Php Script looks like:

<table>
<tbody>
<?php
for ( $counter = 0; $row = mysql_fetch_row( $result ); $counter++ )
{
print("<tr>");
foreach ( $row as $key => $value )
print( "<td>".$value."</td>");
print("</tr>");
}
print("</tbody>");
print("</table>");
mysql_close($database);
?>

Solution

  • It's not passing validation because you've got nothing in your TBODY. Add some rows with columns and it'll validate.