Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 18th, 2006, 03:43 AM
Friend of Wrox
 
Join Date: Mar 2005
Posts: 264
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to pass user info to diffrent pages using sess

Hi all i wonder how i can pass user information such as login name to diffrent pages using sessions. My intention is that i want in diffrent pages the php pages automatically knows who is using the page and where user log name is necessary it is avaliable by just doing echo $username or using $username in queries.Furthermore, i want the sessions some how expire within 15 min or so.I be happy if an expert show me how i can create sessions and how to use it in php pages for above purpuse. Thanks
 
Old February 19th, 2006, 10:49 AM
Registered User
 
Join Date: Feb 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

In order to use session variables they must be declared as:
$_SESSION['your_variable'];

Providing you have declared SESSION_START(); at the begining of your script each time you want to use your session variable.

Patience, perseverance, persistence...yessss!!!!
 
Old February 19th, 2006, 04:56 PM
Friend of Wrox
 
Join Date: Mar 2005
Posts: 264
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by aceconcepts
 Hi,

In order to use session variables they must be declared as:
$_SESSION['your_variable'];

Providing you have declared SESSION_START(); at the begining of your script each time you want to use your session variable.

Patience, perseverance, persistence...yessss!!!!
Many thanks for u reply. Do u mean in my first page i do some thing like this at the top of page :
Code:
SESSION_START(); 
$_SESSION['your_variable'];
when i go to next page shoud i pass variable or some thing ? how to use the variable stored in session in 2 page ? how to call it ?Thanks
 
Old February 27th, 2006, 01:08 AM
Authorized User
 
Join Date: Jan 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,(Assalamo Aliekum),

                      Yes it is good to use session_start() at the beginning of the code, but it does not work when we user
("Location:newusers.php"); after that.then what will be the solution.

Thanks.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Pass values between pages msbsam ASP.NET 2.0 Professional 1 July 7th, 2008 06:13 AM
How to pass values between different pages dipanjan22 ASP.NET 1.x and 2.0 Application Design 4 September 30th, 2007 02:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.