From: andreas dot schmitter at swisslife dot ch
Operating system: WIN2000 Prof
PHP version: 4.3.4
PHP Bug Type: Session related
Bug description: Session ID lost when form-tag split
Description:
------------
For some reasons i can not use cookies for session handling and therfore
use the only the transparent session id, which works fine. But recently i
got the following problem:
I have a form which has different action based on a variable ($ref). With
the first code snippet
(output of the Form-Tag as one string)
it worked fine. But with the second snippet (Form-Tag is split) the
session id is somehow lost.
Both ways the form worked and all the variables are passed correctly.
Regards
Andreas Schmitter
Reproduce code:
---------------
<?php if ($ref=='actlist') {
echo '<form name="goback" method="post" action="act_list.php">';
} else {
echo '<form name="goback" method="post" action="user_home.php">';
}
?>
<input type="hidden" name="ref" value="<?php echo $ref ; ?>">
<input type="submit" class="button" name="back" value="<?php echo
$msg['cancel'];?>">
</form>
----------------------------------------------------------
<form name="goback" method="post"
<?php if ($ref=='actlist') {
echo ' action="act_list.php">';
} else {
echo ' action="user_home.php">';
}
?>
<input type="hidden" name="ref" value="<?php echo $ref ; ?>">
<input type="submit" class="button" name="back" value="<?php echo
$msg['cancel'];?>">
</form>
Expected result:
----------------
Result of Code Snippet 1:
<form name="goback" method="post" action="user_home.php"><input
type="hidden" name="PHPSESSID" value="066a2f65204eccb562831f3f1d8d88e5"
/><input type="hidden" name="ref" value="uhome">
<input type="submit" class="button" name="back" value="Cancel">
-----------------------------
Result of Code Snippet 2:
<form name="goback" method="post"
action="user_home.php"><input type="hidden" name="ref" value="uhome">
<input type="submit" class="button" name="back" value="Cancel">
--
Edit bug report at http://bugs.php.net/?id=26482&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26482&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26482&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26482&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26482&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26482&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26482&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26482&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26482&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26482&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26482&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26482&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26482&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26482&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26482&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26482&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26482&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26482&r=float