Re: Problems with Validation
by Andrew McFarland <aamcf(at)aamcf.co.uk>
|
Date: |
Sun, 15 Sep 2002 20:52:07 +0100 |
To: |
<hwg-basics(at)hwg.org> |
Cc: |
"Caryl A. Milton" <tippybird(at)earthlink.net> |
In-Reply-To: |
home |
|
todo: View
Thread,
Original
|
|
At 15:06 15/09/02 -0400, Caryl Milton wrote:
> ... cal.com/cat_disp.asp?SUB_CAT_NBR=0&CAT_NBR=7&NAV=6">
> ^Error: unknown entity "CAT_NBR"
Try
SUB_CAT_NBR=0&CAT_NBR=7&NAV=6
>I have tried doing a double ampersand sign in each place, but that causes an
>error message when you try to click on and visit that site.
When an & appears in an XHTML document, it indicates the start of an
entity. If you don't mean it to be an entity, you must escape it as &.
Every time you have a `&' in an (X)HTML document you must escape it with
&, even if it is in an attribute value.[1] Browsers are very lax about
interpreting this correctly, so you almost never encounter this problem in
real life, but you do encounter it when validating.
As an alternative, it is valid to use ; as a separator in a URL instead of
the `&'.
SUB_CAT_NBR=0&CAT_NBR=7;NAV=6
This avoids the problem, and any well written CGI script should cope with it.
Andrew
--
http://aamcf.co.uk/
[1] Well, not quite _every_ time - but this is basics, so I won't go into
details. It never harms to escape an `&' when you mean it to be a literal
`&' though.
HTML: hwg-basics mailing list archives,
maintained by Webmasters @ IWA