Re: [PHP] Passing variables between pages



At 8:31 PM +0100 9/20/08, Nathan Rixham wrote:
Am I missing something here..?

Yes. You are missing the point.

This is exactly the same; you don't need $_SESSION's in this case because all you're doing is POST'ing the data every time..

And that's what you are missing -- it's not continued POSTing!

Follow closely,

http://www.webbytedd.com/bb/php-run-php/

While I'm using a Submit Post button to go from this script to the next script I am NOT sending any data via the POST. To prove it, use FF and see what's passed.

All data is passed/available to the next script because the next script is an include.

For example, this parent script has the variable:

$test = "This is a test";

And the next script (either a.php, or b.php, or c.php -- your choice) simply echo's $test.

Please note, the contents of the variable $test was NOT passed via a POST, but rather retained because the parent script included the next script.

Do you see the difference?

Here's another example presenting the same technique in a different way:

http://www.webbytedd.com/bb/tedd/index.php

All the variables remain intact AND there is nothing in the REQUEST, SESSION nor COOKIE arrays.

I have a hard time trying to get people to understand this simple concept. It's so simple that people often overlook how powerful it is.

For example, with a little forethought, I think there isn't a script I've written that I could not have used this technique and dispensed with SESSION's all together. That's pretty powerful, don't you think?

Do you understand what I'm doing now?

no ill-intention meant.

That's Okay -- I realize you meant no ill-intent.

Neither do I -- I realize that occasionally simple concepts are hard for you smarter guys to get because you have to dumb down a lot to consider what we're talking about. But I think it's an interesting concept to consider.

Cheers,

tedd

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



Relevant Pages

  • Re: runtime error do you wish to debug
    ... > having a hard time with ie. getting this message alot: ... Uncheck the box to Display a notification about every script error. ... Sometimes there's a corrupt file in the cache and one must go to Tools | ... Dealing with Hijackware ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: bash vs. python scripts - which one is better?
    ... I have a hard time to remember all those command line options. ... ARexx. ... I've written a script in ARexx for creating mp3 files. ... it opens a small window with these four options and I just have to pick the ...
    (Debian-User)
  • Re: [PHP] Passing variables between pages
    ... tedd wrote: ... While I'm using a Submit Post button to go from this script to the next script I am NOT sending any data via the POST. ... I have a hard time trying to get people to understand this simple concept. ...
    (php.general)
  • Re: Need to find a file, if it exists move it to a new name in the same directory.
    ... >> I am working on a script to interogate several Solaris systems for a ... >> I have been messing around with a script and have it to the point ... What I am having a hard time with is finding the way to give $filename ...
    (comp.unix.shell)
  • Re: Help with first script please. files, directories, autocomplete
    ... reports named like this; 12345A-F.doc. ... Most inspections also require a technique which is saved as a pdf. ... My command line script will work like this: ...
    (comp.lang.python)