Re: Newbie question about variable scope in Apache 2.0 & PHP
| From: | Wendell Brown | Date: | Wed, 07 May 2003 17:10:37 +0000 |
| Subject: | Re: Newbie question about variable scope in Apache 2.0 & PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146709@lists.php.net to get a copy of this message | ||
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";