Page 1 of 1

How to define a variable on one mage, and make it available

Posted: Mon May 19, 2003 10:42 pm
by infolock
Could someone tell me how to make a variable I define on one page, available to any other page I want to call it from ?

Example:

Login.php has 2 text boxes. One is named user, the other is named pwd.

Then, on my authentication script, I give each post value a variable name:

$username = $_POST['user'];
$password = $_POST['pwd'];

It then forwards me to a "User Main Menu" page, of which I want to say "Welcome $username", where $username = post value.


I know this has to be very easy... I've looked in my book, but I must be over looking how to do this... Any help is appreciated.

Posted: Mon May 19, 2003 10:57 pm
by Doolittle
Sessions are what you want...

http://www.php.net/manual/en/ref.session.php

Posted: Mon May 19, 2003 10:58 pm
by zoki
You use either cookies or sessions to do that.

Posted: Mon May 19, 2003 11:07 pm
by infolock
yeah, I know how to name a session, and start a session.. but that page you just posted doesn't tell me how to use a variable in order to define a session name, or how to call it later...

Posted: Tue May 20, 2003 2:29 am
by twigletmac
Maybe one of the stickies can help:
Before Post Read: Sessions with a Minor in User Logins

Mac