Re: passing variables
| From: | Nicole Amashta | Date: | Mon, 14 Jan 2002 14:37:44 +0000 |
| Subject: | Re: passing variables | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-11422@lists.php.net to get a copy of this message | ||
when you call the 2nd script, new.php, call it like this:
new.php?sign=$data
that is one way to pass it ... or you can keep the variable hidden by using
sessions
1. xmlparse.php
-------------------------------
session_start(); // start a session
session_register("data"); // register 'data' as a session var
$data = "whatever"; // assign a value
---------------------------------
2. now going on to the next script: new.php
---------------------------------
session_start(); // start a session
$sign = $data; // $data should already have the value previously assigned;
since it's in session, the value carries over
echo $sign; // should display "whatever"
-------------------------------------------
try that.
also, you can try doing this in your original example:
<snip>
new.php
include('xmlparse.php')
global $data; // add this line; do a "global" to make sure you
grab the $data var
$sign = "$data";
echo "$sign";
</snip>
Goodluck!
Nicole Amashta
www.aeontrek.com
========================
"Sandeep Murphy" <Sandeep.Murphy@oni.pt> wrote in message
news:69E9C8885D77554CAF2A7C5C690F43595B61A8@arexcprd01.e3g.pt...
>
> hi all,
>
> I have a variable in a file called xmlparse.php called $data. $data stores
> in it an output returned by another php script..
>
> I need to pass this variable $data now into yet another php file say
new.php
> ..
>
> xmlparse.php
>
> $data = "blah blah";
>
> --------------------------------------------------------------------------
--
> ----
> new.php
>
> include('xmlparse.php')
>
> $sign = "$data";
>
> echo "$sign";
>
> But my echo "$sign"; is NOT printing anything.. Whats wrong here??
>
> TIA,