开发者

Pass PHP variable from one page to another and to another [duplicate]

This question already has answers here: 开发者_如何学C Closed 11 years ago.

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'].

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜