On Fri, May 21, 2004 at 08:35:37PM +0200, Torsten Roehr wrote:
> Sorry, I'm an idiot! The ? was missing:
>
> <form method="post" action="xxx.php?<?= SID; ?>">
>
Well, I spoke too soon. It does work, but only the SECOND time the
script is run!
Stage:0 SessionID: 6c9a1819fe95fa6f08f385ee2afa71ca
______ [Submit]
Stage:1 SessionID: 6c9a1819fe95fa6f08f385ee2afa71ca Request: Array ( )
Type "foo" into the form, hit submit and the session variable is not being
preserved:
Stage:0 SessionID: ac429ad0086eb5b4d1130eb2e2fddcb9
foo___ [Submit]
Stage:1 SessionID: ac429ad0086eb5b4d1130eb2e2fddcb9 Request: Array ( [PHPSESSID] =>
6c9a1819fe95fa6f08f385ee2afa71ca [field] => foo )
Type "bar" into the form, hit submit and the session variable
IS being preserved:
Stage:1 SessionID: ac429ad0086eb5b4d1130eb2e2fddcb9
bar___ [Submit]
Stage:1 SessionID: ac429ad0086eb5b4d1130eb2e2fddcb9 Request: Array ( [PHPSESSID] =>
ac429ad0086eb5b4d1130eb2e2fddcb9 [field] => bar )
So, what am I missing here?
Code, for reference:
<?
if (!isset($_SESSION['stage'])) {
$_SESSION['stage'] = 0;
}
if (!isset($_POST['field'])) { $_POST['field'] = ""; }
?>
<html>
<head><title>PHP Test page</title></head>
<body>
<?
echo "Stage:"; echo $_SESSION['stage'];
echo " SessionID: "; echo session_id();
$_SESSION['stage'] = 1;
?>
<form method="post" action="xxx.php?<?= SID; ?>">
<input type="text" maxlength="7" size="7" name="field" value="<?echo
$_POST['field']?>">
<input type="submit" value="Submit">
</form>
<?
echo "Stage:"; echo $_SESSION['stage']; echo " ";
echo " SessionID: "; echo session_id(); echo " ";
echo " Request: "; print_r($_REQUEST);
?>
</body> </html>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php