: Should query string parameter values in a URI have single quotes around them? I'm passing variables through the URI string, like this: example.com?a=first&b=second Everything works as intended,
I'm passing variables through the URI string, like this:
example.com?a=first&b=second
Everything works as intended, but when I pass the source code through the W3 validator, it's flagging them as errors. When I quote the variables, like this:
example.com?a='first'&b='second'
they do not get flagged. I've never seen a website do this, but is that the proper way to pass these variables? I could not find any source that recommends quoting them in the URI.
More posts by @Gonzalez347
1 Comments
Sorted by latest first Latest Oldest Best
<a href="link.php?a=first&b=second">Click here!</a>
The only thing that might get flagged in that anchor is the unencoded &. The & should be HTML encoded. ie. & (in order to avoid potential conflict). URL parameters certainly should not be quoted as a general rule.
The URL, by its very nature, is all a "string", so quoting URL parameter values for the sake of it does not make sense, unless you explicitly needed this for your script (although this should probably be avoided, as it just adds clutter).
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.