(This msg. may arrive twice, with two different senders, I've had a little trouble with the news server)
Hi, thanks for your reply.
first $_SESSION works like this:
session_start(); $_session[user]=$_POST[user];//if using register_globals=off $_SESSION[user]=$user;//if register_globals=on..unsafe though
$_SESSION superglobal is an array (usually associative) meaning that the element of the array (the part in the []) is either a variable name or
some
custom name instead of the element number....
$_POST[user] and $user are 2 different variables if
register_globals=off...
Just a couple of questions. 1. I tried adding the lines as you wrote them, but then I got a "Notice: Use of undefined constant user - assumed 'user' in [FILENAME]", I assume I need to add quotation marks around "user" on both sides of the equal sign, that at least removes that notice. 2. I also get a "Notice: Undefined index: user in [FILENAME]", do I need to declare the $_SESSION variable before populating it?
This is due to using this syntax: $_SESSION[user]
You want to do this instead: $_SESSION['user'] = $_POST['user'];
Whenever you index into an associative array, you should use strings for the key/index (i.e. use quotation marks). That is, unless you're using define(), but that's out of scope for this thread. ;-)
-- paperCrane <Justin Patrin>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php