Session: where is my mistake?
| From: | Radu Filip | Date: | Thu, 31 Aug 2000 13:34:46 +0000 |
| Subject: | Session: where is my mistake? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-14572@lists.php.net to get a copy of this message | ||
Hi! I try to write some kind o wizard in PHP. This wizard will get some
information from the user, in several steps and then, it will call a
proceed page. Unfortunatelly, I have some problems with sessions.
Here is a sample of what I trying to do:
[radu@gamma test]$ cat step1.php
<?
session_start();
echo "<form method=post action=\"step2.php\">";
echo "Name: ";
echo "<input type=text name=person_name><br>";
echo "<input type=submit name=submit value=next>";
echo "</form>";
?>
[radu@gamma test]$ cat step2.php
<?
session_register("person_name");
echo "<form method=post action=\"step3.php\">";
echo "Address: ";
echo "<input type=text name=person_address><br>";
echo "<input type=submit name=submit value=next>";
echo "</form>";
?>
[radu@gamma test]$ cat step3.php
<?
session_register("person_address");
echo "<form method=post action=\"step4.php\">";
echo "<input type=submit name=submit value=finish>";
echo "</form>";
?>
<?
echo "You entered the following information:<br>";
echo "Name: $person_name<br>";
echo "Address: $person_address<br>";
session_destroy();
echo "<a href=\"step1.php\">Back to step 1</a>";
?>
Unfortunatelly, when I reach step 4 I get this result:
You entered the following information:
Name:
Address:
Warning: Trying to destroy uninitialized session in
/home/staff/radu/public/web/html/test/step4.php on line 7
Back to step 1
which is not what I need. So, where is my mistake regarding to sessions
management?
Thx,
Radu
P.S. My PHP4 is compiled with the following options:
./configure --with-apxs --enable-force-cgi-redirect --enable-trans-sid
--enable-register-globals
I use a RH Linux 6.2 distribution and Apache 1.3.12 (shiped with
distribution). PHP version is 4.0.2
--
Radu Filip
Network Administrator @CCTI | tuiasi.ro
radu@tuiasi.ro ccti@tuiasi.ro
http://socrate.tuiasi.ro/ http://www.ccti.tuiasi.ro/