Re: Keeping POST values when paging

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

 



At 9:33 PM +0100 7/8/08, Stut wrote:
I've only had a quick look but as far as I can see it's keeping the vars in a form, the form posts to index.php so I'm guessing index.php simply includes the script you specify on the form.

Not what I would call "pass[ing] variables between scripts" but that's just semantics.

-Stut

As I figured, the smart ones would figure it out pretty easily.

In the old days when memory was tight we used to do something we called overlays.

The process worked like this:

1. Your program would compute what it could with what memory was available.

2. Then the program would halt and the variables used to that point would be frozen in memory.

3. Then another program was loaded on top of the in situ program with spaces in the memory for the values.

4. Then the program would take off again using the new program and those variables.

5. The process would repeat as many times as necessary.

Now, in this case I am not swapping scripts because of memory restraints, but rather bringing in new scripts to continue with another part of the program -- but, I'm exiting the old script.

It turns out to be a very simple process and it works like this.

Run your first script, populate whatever variables you need (including post, get, and such) and then figure out where you want your program to go (i.e., next phase). Instead of populating a bunch of sessions, or filling up a database with values, simply --

ob_clean();
include('theNextScript.php');
exit();

-- and bingo! TheNextScript.php will have all the variables your original script had and your old script will be no more.

-Stut is technically right, it's not really passing variables but rather "overlaying" a new script on top of the old one.

In any event, I find it a neat way to continue a script without having to resort to using sessions, or other such storage mechanisms, to "pass" variables to the new script.

Try it -- it works neat.

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