homepage Welcome to WebmasterWorld Guest from 54.221.175.46
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
$ session variables
nadeem14375




msg:4503331
 8:08 am on Oct 3, 2012 (gmt 0)

Dear all,

I want to store some information like user_name, country_name etc and need to be available through out the session.

1. what will be the best way to achieve this?
2. I have the following code to $_session variable but have no result.
page1.php
session_start;
$_SESSION['country_no']=1;


page2.php

session_start;
echo "here is session variable=".$_SESSION['country_no'];
exit;


Regards:

 

rainborick




msg:4503598
 5:45 pm on Oct 3, 2012 (gmt 0)

I'd suggest that you check to make sure that the server is set up properly to support sessions. Run your test again, and then check the server error logs to see if there was a problem opening the sessions file. You may have to use ini_set() to point 'session.save_path' to a writable directory. phpinfo() will show you where the system currently expects to see the sessions data file.

nadeem14375




msg:4503830
 4:32 am on Oct 4, 2012 (gmt 0)

Thankds rainborick,

the problem was with session_start;
I forget to mention ();

thank you so much.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved