Pass PHP variable from one page to another and to another [duplicate]
Possible Duplicate:
pass value from page to another in PHP
For example, I have 3 pages. First page will be a regular HTML login page which will ask for username. Second page will get this username variable thru POST function and assign a php variable such as $username. Third page will take this $username variable and display it. How can this be done? I have done the first two pages but I need help with passing it to the third page. Thanks!
Check the PHP documentation for sessions. There are many examples of how to do this.
http://www.php.net/manual/en/session.examples.basic.php
Use a $_SESSION superglobal: http://us3.php.net/manual/en/reserved.variables.session.php
You'll need to use a session_start() function at the beginning of any page you want to maintain session data for. After that, you can just assign to and retrieve from $_SESSION['username'].
精彩评论