Re: Variable Problems
| From: | George Nicolae | Date: | Fri, 06 Jun 2003 13:01:31 +0000 |
| Subject: | Re: Variable Problems | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-20222@lists.php.net to get a copy of this message | ||
In the name.php file try to
echo "Hello ".$_GET["name"];
If it works mean that you have register_globals = off in your php.ini file.
Make the register_globals = on and the echo "Hello $name" will work but I
advive you to not make the register_globals = on due to some security
issues.
--
Best regards,
George Nicolae
IT Manager
___________________
PaginiWeb.com - Professional Web Design
www.PaginiWeb.com
"Dylan Williams" <dylan@plugmusic.com> wrote in message
news:20030606090840.30661.qmail@pb1.pair.com...
> Hi all,
>
> I'm having trouble using variables.
>
> If I create a PHP file and define the variables within it (e.g. $name =
> "Bob";) and then ask the same file to ouput the variable as part of an
echo
> command (e.g. echo( "Hello, $name"); ), it works fine.
>
> The problem comes when I try to link to a PHP file from an HTML file (e.g.
> <A HREF="name.php?name=Bob"> I am Bob </A>. Instead of displaying the
> sentence as defined in the PHP file (e.g. echo( "Hello, $name"); ), I get
> the following error message:
>
> Notice: Undefined variable: name in e:\xxx\name.php on line 43
>
> Does anyone know what the problem might be? I've tried writing the code
in
> a number of different ways but with the same result. Could it be that my
> PHP or IIS server settings are not quite right?
>
> Many thanks for any help!
> Dylan.
>
> --
> Dylan J. Williams
> Silent Films & Plug Music (HK) Limited
>
> GPO Box 8315,
> Central, Hong Kong SAR,
> China.
> Ph: +852 9641 2246 Fx; +852 2809 2550
> www.silent-films.org
>
>