I have a piece of code which need to be validated for XHTML. I don't find any serious errors, but the w3 validator finds six errors and one warning:
Error: Saw
<?
. Probable cause: Attempt to use an XML processing instruction in HTML. (XML processing instructions are not supported in HTML.) At line 1, column 2<?php↩ $PROGNAVN
Warning: Comments seen before doctype. Internet Explorer will go into the quirks mode. From line 1, column 1; to line 3, column 2
<?php↩ $PROGNAVN = "Spare Siden ®";↩?>↩<!DOC
Error: Saw
<?
. Probable cause: Attempt to use an XML processing instruction in HTML. (XML processing instructions are not supported in HTML.) At line 11, column 2
head>↩<body>↩↩<?php↩ echo "<h2
Error: Stray end tag h2. From line 12, column 41; to line 12, column 45
ROGNAVN ."</h2><br />
- Error: Text not allowed in element ol in this context. From line 15, column 12; to line 15, column 13
echo "<ol> ↩ <l
Content model for element ol: Zero or more li and script-supporting elements.- Error: Text not allowed in element ol in this context. From line 16, column 56; to line 16, column 57
g</a></li> ↩ <l
Content model for element ol: Zero or more li and script-supporting elements.- Error: Text not allowed in element ol in this context. From line 17, column 58; to line 17, column 59
r</a></li> ↩ <
Content model for element ol: Zero or more li and script-supporting elements.
I agree with Luchiro and rmjoia.
And to give you a tip, my norwegian mate, I wouldn't echo out that whole block on php. It's simpler, and better to use php within the tags:
<?php
$PROGNAVN = 'Spare Siden ®';
?><!DOCTYPE html>
<html>
<head>
<title><?php echo $PROGNAVN; ?> - Hjemme siden</title>
</head>
<body>
<h2>Velkommen til <?php echo $PROGNAVN; ?></h2>
<p>Her får du hjelp med din personlige økonomi.</p>
<ol>
<li><a href="banksparing.php">Banksparing</a></li>
<li><a href="verdipapirer.php">Verdipapirer</a></li>
</ol>
</body>
</html>
Let me know if you need a web developer.
</div>
The XHTML or any HTML validator validates only html, so when you throw some php at it, it dies. What you can do is run that site of yours in the browser, and take the page source code from there (on Chrome, right button on the page -> View page source). Because php is server side language, after the browser has processed the page, php will not be there.