Adam Perfect

General

The W3C validator and PHPSESSID

At work we're just about to launch a new disability products shop, Disability Warehouse, and so I did a quick run through Silktide Sitescore as it gives a good overview of any major problems with a website. Obviously it got an abysmal 3.2/10 for marketing as we haven't actually told anyone it exists yet, but I was surprised to see that it though the site didn't have valid HTML.I ran the site through the actual w3c validator, which complained about two inputs not being inside a suitable container such as a div or fieldset. Looking at my code, the two inputs were indeed inside fieldsets (and the first was inside a div as well), so why is the validator deciding otherwise? The one thing I did notice in the error is a PHPSESSID - it turns out that with PHP's session.use_trans_sid set to 1, it adds the PHPSESSID as a hidden input right after the form tag, breaking validity. I'd come across the problems with it adding the PHPSESSID in links before, which can usually be gotten around with php_value arg_separator.output "&" (although again not on this site as we use friendly URLs so the PHPSESSID is after a ?), but not this hidden field. In the end I've just turned use_trans_sid to 0 as it's not really necessary these days anyway. People will just need to have cookies on to log in. Being a disability products site though, we'll have to see if that causes problems with some screen readers down the line, in which case we'll need another solution or to just make do with invalid PHPSESSID references when the validator looks at the site. The joys of making sites both valid and accessible eh? While many would talk as though accessibility and valid code are one and the same, there's so much more to it and irritating little things like this, where the programming language hasn't quite handled it in a modern, accessible fashion, a compromise is required.

Written by Adam on

Adam is a Director of User Experience by day and photographer as time allows.

You may also like…