Click to See Complete Forum and Search --> : php validation


kproc
12-03-2006, 09:51 AM
Hi I get the below error when I try to validate page using the W3C site.

# Error Line 199 column 54: an attribute value must be a literal unless it contains only name characters.

...ter bgcolor=white><a href=results.php?eventid=2006-12-10> 10 </a></td><td ali

You have used a character that is not considered a "name character" in an attribute value. Which characters are considered "name characters" varies between the different document types, but a good rule of thumb is that unless the value contains only lower or upper case letters in the range a-z you must put quotation marks around the value. In fact, unless you have extreme file size requirements it is a very very good idea to always put quote marks around your attribute values. It is never wrong to do so, and very often it is absolutely necessary.


I have no idea how to prevent this as I nee the php?

NogDog
12-03-2006, 10:21 AM
<a href="results.php?eventid=2006-12-10">

PS: I just quote all attribute values and then never have to worry about it. (Plus, should you ever decide to migrate to XHTML or XML for some reason, attribute values must always be quoted.)