a google search for "phpsessionid valid xhtml" currently returns 13 results, none of which explain how to produce valid xhtml with php's automatic phpsessionid. it took me a while to figure it out, so hopefully this post will show up in those results soon and help someone else out. what you need to do is put this at the beginning of your script:
ini_set( 'arg_separator.output' , '&' );
ini_set( 'url_rewriter.tags' , 'a=href,area=href,frame=src,input=src,fieldset=' );
the first part will make the automatic URL rewriting for sessions use the HTML entity & rather than the default &, which is invalid XHTML. the next line will add the hidden form input (which is valid XHTML) inside a <fieldset> rather than the default, immediately after the <form> tag, which is invalid XHTML. if you don't already have them, you need to put <fieldset> tags inside all <form> tags to get forms to work with PHP sessions. this will change the appearance of your forms, but you can change it back with some CSS styling.
phpsessionid is a string of text a php script uses to identify you between pages. if you have cookies, it goes in the cookie, but if you don't have cookies, it gets automatically added to any links, so that when you click on a link, the new page will know you are the same person who just loaded the previous page. you can see this in action by turning off cookies and clicking around randomchaos.com.
thx!
I had searched the internet before for an earlier project which gave me similar headaches, and now your post showed up on google within seconds... Excellent!
<IfModule mod_php4.c>
php_flag session.use_trans_sid off
</IfModule>
.alienx
Best
scotts solution is more correct but a bit more complicated to do. AlienXs solution is more a work-around than a fix.
big thanks
But i don't understand the url-rewriter concept, could you explain please ?
in which script do i have to put these two lines in? in my php file? i thought there mustnt be anything before the session_start(); ?! so please help me, i really need to know.
thanks
Fixed my problem and satisfied my anal-retentive streak for producing XHTML Strict instead of Transitional.
And I even (kind of) understood what you did ...
Thank you.
Excellent info, Scott!
Thanks