I'm trying to make a website, but when I try to validate at W3C, there are 2 errors happening:
Line 28, Column 7: Stray end tag head.
</head>
Error Line 29, Column 6: An body start tag seen but an element of the same type was already open.
<body>
My code is:
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="pt-br">
<!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<title>SpotBOT - Engenharia Mecânica Cotidiana</title>
<meta name="description" content="Página pessoal sobre enganharia mecânica, faculdade, dificuldades, trabalhos e realizações na área.">
<link rel="apple-touch-icon" href="/icon-iphone.png" />
<link rel="apple-touch-icon" sizes="72x72" href="/icon-ipad.png" />
<link rel="apple-touch-icon" sizes="114x114" href="/icon-iphone4.png" />
<meta name="viewport" content="width=device-width">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="../css/bootstrap.min.css">
<link rel="stylesheet" href="../css/bootstrap-responsive.min.css">
<link rel="stylesheet" href="../css/main.css">
<script src="../js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
<script src="../WYSIWYG/ckeditor.js"></script>
<?php
include("db_connect.php");
if (!isset($_SESSION)) session_start("Spotbot");
if(isset($_GET['page'])) {$page = $_GET['page'];}else {$page = "index";}
$query_select=mysql_query("SELECT permissao FROM indexpage WHERE pagename = '$page'")or print (mysql_error());;
if (mysql_num_rows($query_select) == 0){$nivel_necessario = 1;}
while($linha = mysql_fetch_array($query_select)){$nivel_necessario = $linha['permissao'];}
if(!isset($_SESSION['UsuarioID'])){$_SESSION['UsuarioNivel'] = "1";}
if ($_SESSION['UsuarioNivel'] < $nivel_necessario) {
session_destroy();
header("Location: http://spotbot.in?page=permission"); exit;
}
?>
<script>
window.onload = function() {
CKEDITOR.replace( 'texto' );
};
</script>
</head>
<body>
<?php include_once("analyticstracking.php") ?>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
<![endif]-->
<!-- This code is taken from http://twitter.github.com/bootstrap/examples/hero.html -->
<div lang="pt-br" class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container"> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a>
<?php include("menu.php");?>
</div>
</div>
</div>
<div class="container" lang="pt-br">
<!-- Main hero unit for a primary marketing message or call to action -->
<div class="hero-unit">
<?php
if(isset($_GET['page'])) {$page = $_GET['page'];}
else {$page = "index";}
$query_select=mysql_query("SELECT * FROM indexpage WHERE pagename = '$page'")or print (mysql_error());;
if (mysql_num_rows($query_select) >= 1){
while($linha = mysql_fetch_array($query_select)){
$title = utf8_encode($linha["title"]);
$text = utf8_encode($linha["text"]);
$link= utf8_encode($linha["link"]);
$button= utf8_encode($linha["button"]);
}
echo "<h2>$title</h2>
<div id='post-data'><p>$text<br/></p></div>";
if ($button != ""){echo "<p><a href='$link' class='btn btn-primary btn-large'>$button »</a></p>";}
echo "</div><!-- Example row of columns --><div class='row'>";
$query_select=mysql_query("SELECT * FROM indexfooter WHERE pagename = '$page'")or print (mysql_error());;
while($linha = mysql_fetch_array($query_select)){
$title = utf8_encode($linha["title"]);
$text = utf8_encode($linha["text"]);
$link= utf8_encode($linha["link"]);
$button= utf8_encode($linha["button"]);
echo "<div class='span4'><h3>$title</h3>
<p>$text<br/>";
if ($button != ""){echo "<p><a href='$link' class='btn'>$button »</a></p>";}
echo "</div>";
}}
else
{
echo "
<h2>Página não encontrada</h2>
<p>A página que você procura não existe ou foi deletada.<br/>
<p><a href='http://spotbot.in' class='btn'>Voltar à pagina principal »</a></p></div>
</div><!-- Example row of columns --><div class='row'>";
}
?>
</div>
<hr>
<footer>
<div id="geral">
<p><a href="https://plus.google.com/107266754114799149959?rel=author">Me encontre no Google +</a></p>
<p>Spotbot© 2013</p>
<p>All rights reserved.</p> </div>
</footer>
</div>
<!-- /container -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../js/vendor/jquery-1.8.3.min.js"><\/script>')</script>
<script src="../js/vendor/bootstrap.min.js"></script>
<script src="../js/plugins.js"></script>
<script src="../js/main.js"></script>
</body>
</html>
Just edited with the full code.
I'm trying to find the error, but I cant find it.
Please, help me find this bug ;)
<?php header('X-UA-Compatible: IE=edge,chrome=1'); ?>doing in your markup? Why aren't you putting that in a regular meta tag instead?<?php ... ?>the markup is valid. So must be either that or something in your body. Second error is definitely in your body tag (your probably have two openingbodytags)header()in the middle of output will most likely spit a warning, causing the markup to be invalidated.