| Welcome to WebmasterWorld Guest from 22.214.171.124 |
register, login, search, subscribe, help, library, PubCon, announcements, recent posts, open posts,
|Subscribe to WebmasterWorld|
|Cannot access $_SESSION varaibles on other pages|
| 5:56 am on Mar 8, 2006 (gmt 0)|
I am facing problem in accessing $_SESSION variables..
I have three page
1. HTML form page that accepts a usre name
2. a php page that checks the valid user name and if valid user sets a session vaiable and redirects to next page msg.php
3. and here is the third page msg.php where i am trying to print the value stored in the $_SESSION variable
echo "Hello Mr/Mrs ".$_SESSION['uname'];
I cant make out whats wrong with this code..can any one help me out
| 7:24 am on Mar 8, 2006 (gmt 0)|
$_SESSION["uname"] = addslashes($_POST['uname']);
| 8:07 am on Mar 8, 2006 (gmt 0)|
This needs to be at the top of every page you are calling session variables.
| 9:19 am on Mar 8, 2006 (gmt 0)|
And, you probably want to call session_write_close() before sending the header() call.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld ® and PubCon ® are a Registered Trademarks of Pubcon Inc.
© Pubcon Inc. 1996-2012 all rights reserved