Re: Passing variables between pages

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

 




At 11:19 PM +0100 9/21/08, Nathan Rixham wrote:
so may as well just have everything in one script then..

You always have the option to write one huge script for any application.

But normally in programming, we confront any problem by breaking it down into smaller steps and writing code to solve smaller problems. Whenever any step is finished, then we pass the results on to the next step and continue solving the problem -- is this not correct?


I guess it is but as you said your self we break the problem into smaller and easier problems not to seperate files. The old way still works:

http://host.net/index.php?mode=jump

Meaning that you can separate the file into parts (with or without includes) that solve different part of the problem. So I guess it's done but the question is in what way it is done and whether it is effective.

In PHP, we use sessions to pass variables between scripts -- but we could just as well use:

ob_clean();
include('next.php');
exit(0);

For this will continue the program flow with all the variables intact the same as using sessions -- is this not correct?


Well actually by including other files I think that is practically like including all the code of the files in your script. But the a basic difference is that you have two separate files which makes the code easier to read, edit and generally maintain.
Maybe I'm not understanding the limitations of this technique -- so, let me put this another way, show me an example where sessions is the answer and my include method won't work.

Cheers,

tedd


I guess every technique has its advantages and disadvantages. It is better for something and bad for something else...

--
Thodoris


--
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