You are here: Re: newbie session code problem « PHP Language « IT news, forums, messages
Re: newbie session code problem

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация