|
Posted by J.O. Aho on 07/19/06 17:06
Robin wrote:
> Dear All,
>
> I have been trying to validate this PHP to XHTML 1.1 for days and run
> out of ideas.... i have most of it validating now, but I cant quite
> finish it! Any help would be great!
>
> My PHP Script...
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
> <html><!-- #BeginTemplate "templates/template.dwt" --><!-- DW6 -->
> <head>
> <title>PHP Contact</title>
>
> </head>
> <body>
>
> <form action="mail.php" method="post">
> <!-- DO NOT change ANY of the php sections --><?php
> $ipi = getenv("REMOTE_ADDR");
> $httpagenti = getenv ("HTTP_USER_AGENT");
> ?> <input type="hidden" name="ip" value="<?php echo $ipi ?>" />
> <input type="hidden" name="httpagent" value="<?php echo $httpagenti
> ?>" />
> <h1>Contact Us</h1>
> <p>Blah Blah</p>
> <p>Your Name:
>
> <input type="text" name="name" class="body" style="width: 242px" />
> </p>
> <p>Your Email:
>
> <input type="text" name="email" class="body" style="width: 242px" />
> </p>
> <p class="body">Your Message</p>
> <p><textarea name="body" style="width: 321px; height:
> 63px"></textarea></p>
> <p><input type="submit" value="Send comments" /></p>
> </form>
>
> </body>
>
Result: Failed validation, 5 errors
File: upload://Form Submission
Encoding: utf-8
Doctype: XHTML 1.1
Root Namespace: http://www.w3.org/1999/xhtml
1. Error Line 11 column 112: document type does not allow element "input"
here; missing one of "ins", "del", "h1", "h2", "h3", "h4", "h5", "h6", "p",
"div", "address", "fieldset" start-tag.
....ut type="hidden" name="ip" value="" />
The mentioned element is not allowed to appear in the context in which you've
placed it; the other mentioned elements are the only ones that are both
allowed there and can contain the element mentioned. This might mean that you
need a containing element, or possibly that you've forgotten to close a
previous element.
One possible cause for this message is that you have attempted to put a
block-level element (such as "<p>" or "<table>") inside an inline element
(such as "<a>", "<span>", or "<font>").
2. Error Line 12 column 72: document type does not allow element "input"
here; missing one of "ins", "del", "h1", "h2", "h3", "h4", "h5", "h6", "p",
"div", "address", "fieldset" start-tag.
....put type="hidden" name="httpagent" value="" />
3. Error Line 25 column 5: required attribute "rows" not specified.
63px"></textarea></p>
The attribute given above is required for an element that you've used, but you
have omitted it. For instance, in most HTML and XHTML document types the
"type" attribute is required on the "script" element and the "alt" attribute
is required for the "img" element.
Typical values for type are type="text/css" for <style> and
type="text/javascript" for <script>.
4. Error Line 25 column 5: required attribute "cols" not specified.
63px"></textarea></p>
5. Error Line 29 column 7: end tag for "html" omitted, but OMITTAG NO was
specified.
</body>
You may have neglected to close an element, or perhaps you meant to
"self-close" an element, that is, ending it with "/>" instead of ">".
NOTE: If you don't have the page on a server that supports PHP, then you have
to manually process the script with the php and then cut and paste the result
to the validator.w3.org "Validate by Direct Input".
Otherwise use the "Validate by URL" and give the address to the php page that
you want to have validated.
Don't use "Validate by File Upload" as that way you will have PHP code which
won't be valid no matter if you choose to use html/xhtml or whatever.
//Aho
Navigation:
[Reply to this message]
|