Re: Newbie question about variable scope in Apache 2.0 & PHP

From: Date: Wed, 07 May 2003 17:17:02 +0000
Subject: Re: Newbie question about variable scope in Apache 2.0 & PHP
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-146711@lists.php.net to get a copy of this message
Excellent! This worked perfectly. Thank you for the help. One other question: Is there a reason to prefer one method over another from an efficiency standpoint? Steve H. "Wendell Brown" <wbrown@arkie.net> wrote in message news:200305071710.h47HAbX4030670@arkie.net... > On Wed, 7 May 2003 11:31:25 -0400, Steve Henderson wrote: > > >I am having trouble with variables remaining in scope between forms and > >scripts. I keep getting errors saying $val1 is not defined etc. This > > I suspect that the problem is that you have "register_globals" turned > off (it's a safety default in newer versions of PHP). There are a few > possible solutions: > > 1) Turn on register_globals on... this can be set in the php.ini or > (under Apache) in the .htaccess file. > > 2) Use the "long name" for the variable. Instead of: > > echo "$val2"; > > try this: > > echo "$_POST(\"val2\")"; > > 3) Or extract the $_POST array.... > > extract( $_POST ); > echo "$val2"; > >

« previous php.general (#146711) next »