faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

22 of 29 people (76%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How can I do to not use session_start() in every page where I redirect a main page with "redirect"?

Feb 26th, 2008 00:09
dman, Narendra Jain, Adi Muraru, http://www.ttnr.org


If you are redirecting a user to a different page, the session id
(PHPSESSID) does not get carried on, unless it is specifically passed on
to the new page. If the PHPSESSID is passed then, when you use
session_start, it uses the original session and uses all the variables
you have registered.
So the important aspect is for you to pass on the PHPSESSID to all your
pages.
Hope that helps...
Narendra Jain