Re: Passing variables between pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 11:15 AM -0400 9/19/08, Jason Pruim wrote:
It makes perfect sense... Was just trying to avoid sessions since this application will be limited to about 10 people and restricted to the company intranet :)

But the script is still stateless regardless of the number of people or if it's limited to the company's intranet. In either event, when the user moves from one page to another page, all the variables are lost. So, you need to use sessions or cookies.

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

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux