At 8:39 PM +0100 9/21/08, Stut wrote:
On 21 Sep 2008, at 18:13, Nathan Rixham wrote:
at it's simplest is this correct..?
index.php
<?php
$variables = $_POST;
include 'anotherscript.php';
?>
anotherscript.php
<?php
print_r( $variables ); //include has access to $variables from parent
print_r( $_POST ); //include has access to post data as well
?>
I'm struggling to follow here I thinks! lol
I don't think you're missing the point Nathan, I think you've hit it
on the head. This technique does not solve the problem of passing
variables between requests. I think the only benefit here is to
avoid having to repost data by including the next script rather than
bouncing off the browser.
Or maybe I'm missing the point.
-Stut
-Stut and Nathan:
The problem was not how to pass variables between requests, but
rather how to variables between pages -- as the subject line
indicates.
There are several options available to do this, I can use POST, GET,
COOKIE, and SESSION -- correct?
Now, I am only demonstrating there is another option -- try this:
script1.php
<?php
$test = "this is a test';
ob_clean();
include('a.php');
exit(0);
?>
script2.php
<?php
echo($test);
?>
Running this successfully passes the variable $test from script1.php
to script2.php -- does it not?
Here's a working example (showing all code):
http://www.webbytedd.com/bb/script2script/
Sure, I am using a form to trigger this operation so you can see it
happen, however there is no data contained or passed by the POST --
as shown by the empty print_r($_REQUEST).
While this is very simple -- it does pass variables from one script
to another without using POST, GET, COOKIE, or SESSION.
Or is there something here that I am not getting?
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