RE: [PHP-WIN] Re: passing variables

From: Date: Mon, 14 Jan 2002 17:10:15 +0000
Subject: RE: [PHP-WIN] Re: passing variables
Groups: php.windows 
Request: Send a blank email to php-windows+get-11430@lists.php.net to get a copy of this message
hi, Thnx to all of you... Actually I realized that my problem is slightly more different and complicated.. The xml output is actually received from a servlet (sorry for saying php before!:)) and Needs to be directly passed into another PHP which contains an XMLparser... The data has to be dynamically fed into the parser... I am trying to make the parser into a form of a class with a function that receives this variable but so far Unsuccessful.. If anyone has any further suggestions/ideas, wud be damn gratefull!! I can post the parser here if needed... TIA, sands -----Original Message----- From: Pac mon [mailto:cake27@hotmail.com] Sent: segunda-feira, 14 de Janeiro de 2002 14:48 To: php-windows@lists.php.net Subject: Re: [PHP-WIN] Re: passing variables There is NO need for that... When including a file it's as if the file were inline with the code in the spot in which include() is called. You may want to use require() to make sure that the file is actually being added. Also you just need to use $data wherever you want.. Or you can do it like this: $sign = $data; > >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, > > > >-- >PHP Windows Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net >For additional commands, e-mail: php-windows-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net > _________________________________________________________________ Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.com -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net For additional commands, e-mail: php-windows-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.windows (#11430) next »