Re: Passing variables between pages

From: Date: Mon, 22 Sep 2008 15:54:40 +0000
Subject: Re: Passing variables between pages
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-280698@lists.php.net to get a copy of this message
I would think debugging a chain of code is more of a nightmare than debugging a $_SESSION variable. Also, HTTP is a stateless protocol no matter what you do. If you want to pass data around, the only ways to do it are $_SESSIONS and cookies with $_SESSIONS being preferable as they stay on the server. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com tedd wrote: > However, there is another way, but it takes a little forethought. > > The technique is simply to continue the flow of a "single" script by > using includes. Here's an example: > > http://www.webbytedd.com/bb/tedd/index.php > > The code behind this is very simple. You simply branch to other > scripts by doing this: > > ob_clean; > include('the-next-script.php"); > exit(); > > This keeps ALL the variables intact because it acts like one large > script. -- it's not stateless and this technique works. > > However, what I don't understand is why it isn't used more often? > > Unless there is something here I don't understand, I believe I could > use this technique to write all the scripts I currently use without > ever using a session variable. > > Cheers, > > tedd >

« previous php.general (#280698) next »