php session and xhtml compatibility

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wolf
Forum Newbie
Posts: 3
Joined: Sun Oct 13, 2002 9:54 am

php session and xhtml compatibility

Post by wolf »

Hi,

I am using sessions in php but would like to have the resulting html page compatible with xhtml1.1. This however seems not to be possible because php inserts a line
<input type="hidden" name="PHPSESSID" value="..." />
right after the <form> tag:
<form action="error_report1.php" method="post">

The validation will tell me: Error: element "input" not allowed here; possible cause is an inline element containing a block-level element

Grateful for the solution!

Many thanks

Wolfgang
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

do you have something like a <table> in your form?
you may turn off session.use_trans_sid in php.ini and only use cookies for sessions.
If you don't like cookies you may delete the form-entry from url_rewriter.tags and write put a apropriate entry in the form yourself (all the time)
wolf
Forum Newbie
Posts: 3
Joined: Sun Oct 13, 2002 9:54 am

Post by wolf »

1)
It goes like this:
<form action="error_report1.php" method="post">
<div>
<table summary="error report form">

however, php inserts its line right after the "post"> and before the <div>...

2)
I cannot change php.ini because I have no access to it

3)
I have never heard about url_rewriter.tags, but searching for it it turned out that the behaviour I reported is already a known php bug and is expected to be fixed in php 4.3. So: Many thanks!
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

if cookies are enabled for session-support you might try to disable trans_sid within your script.

Code: Select all

ini_set('session.use_trans_sid', 0);
Unsure wether scripts can change this parameter or not. Put it a the top of the script if you want to try
Post Reply