Posted by Xylene2301 on 09/29/52 12:00
It's a little hard to see. I've numbered the lines and the
session_start(); for tst1.php is on line 2 under the <?php.
I'm pretty sure the session is running because both scripts echo the same
$PHPSESSID.
tst1.php
1 <?php
2 session_start(); // start the session
3 $_SESSION['username'] = "Goody";
4 echo $PHPSESSID ."<br>";
5 echo $_SESSION['username'];
6 ?>
7 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
8 "http://www.w3.org/TR/html4/loose.dtd">
9 <html>
10 <head>
11 <title>tst1</title>
12 </head>
13
14 <body>
15
16 <form method="post" name="ThisForm" action="tst2.php">
17 <button onclick="submit()">t2</button>
18 </form>
19
20 </body>
21 </html>
tst2.php
1 <?php
2 echo $PHPSESSID ."<br>";
3 echo $username;
4 echo $_SESSION['username'];
5 ?>
6 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
7 "http://www.w3.org/TR/html4/loose.dtd">
8 <html>
9 <head>
10 <title>tst2</title>
11 </head>
12
13 <body>
14
15 <form method="post" name="ThisForm" action="tst1.php">
16 <button onclick="submit()">t1</button>
17 </form>
18
19 </body>
20 </html>
Navigation:
[Reply to this message]
|