evie Posted August 10, 2007 Share Posted August 10, 2007 I am trying to pass session variables from one web page to the other throughout my website but it seems impossible.. I am using php 4.3.1 and put following code for session registration session_start(); $_SESSION["$username"]=$_POST["username"]; Additionaly, i tried to append session_register("username") and global $username; to the code, but unfortunately to no avail. Could you please help me out? Maybe I need to change some settings in my php.ini file? So far, php.ini has following content: register_globals = off allow_url_fopen = off expose_php = Off max_input_time = 60 variables_order = "EGPCS" extension_dir = ./ upload_tmp_dir = /tmp precision = 12 SMTP = relay-hosting.secureserver.net session.save_handler = files session.use_cookies = 1 session.name = FOO session.auto_start = 0 session.cookie_lifetime = 60 session.cookie_path = c:\temp session.cookie_domain = session.serialize_handler = php session.gc_probability = 1 session.gc_maxlifetime = 1440 session.referer_check = session.entropy_length = 0 session.entropy_file = session.cache_limiter = private session.cache_expire = 180 session.use_trans_sid = 1 Any help would be greatly appreciated, cause I have literally spent hours for this matter! Evie Quote Link to comment https://forums.phpfreaks.com/topic/64181-solved-php-sessions-help/ Share on other sites More sharing options...
jaymc Posted August 10, 2007 Share Posted August 10, 2007 $_SESSION[user] = "bob"; echo $_SESSION[user]; Will produce bob Quote Link to comment https://forums.phpfreaks.com/topic/64181-solved-php-sessions-help/#findComment-319903 Share on other sites More sharing options...
komquat Posted August 10, 2007 Share Posted August 10, 2007 try single quotes $_SESSION['user_name'] = $_POST['user_name']; Quote Link to comment https://forums.phpfreaks.com/topic/64181-solved-php-sessions-help/#findComment-319904 Share on other sites More sharing options...
Fadion Posted August 10, 2007 Share Posted August 10, 2007 U dont need the $ sign if isnt your intend to call a variable: normal $_SESSION["username"]=$_POST["username"]; if calling a variable $_SESSION[$username]=$_POST["username"]; Anyway when using double quotes it returns the variable so if u were calling it, thats not causing your problem, i guess. Quote Link to comment https://forums.phpfreaks.com/topic/64181-solved-php-sessions-help/#findComment-319917 Share on other sites More sharing options...
evie Posted August 10, 2007 Author Share Posted August 10, 2007 The code works now. Thank you very much for your fast replies! ' Good night from Greece! Quote Link to comment https://forums.phpfreaks.com/topic/64181-solved-php-sessions-help/#findComment-319931 Share on other sites More sharing options...
teng84 Posted August 10, 2007 Share Posted August 10, 2007 try single quotes $_SESSION['user_name'] = $_POST['user_name']; actually sigle or double wont matter Quote Link to comment https://forums.phpfreaks.com/topic/64181-solved-php-sessions-help/#findComment-319933 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.