Re: undefined variable
| From: | daniel cozzolino | Date: | Thu, 07 Feb 2002 22:39:46 +0000 |
| Subject: | Re: undefined variable | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-11903@lists.php.net to get a copy of this message | ||
You can also avoid these errors by prefixing your variables like so:
> if(@$user1==$USER && @$password1==$PASSWORD) {
This has the advantage of skipping the error on this occasion rather than
for all.
dan
"Nicole Amashta" <430ntr3k@bellsouth.net> wrote in message
news:20020205145928.21097.qmail@pb1.pair.com...
> In your php.ini, replace your error_reporting line with this one:
>
> error_reporting = E_ALL & ~E_NOTICE
>
> That should get rid of the warnings since pre-defining vars in PHP isn't
> really required (as in Java).
>
> Good luck,
> ~Nicole Amashta
> www.aeontrek.com
>
>
> "Bz" <bz586@163.com> wrote in message
> news:20020205080900.075321C62D4A9@sm4.163.com...
> Hello everyone,
> I have a small question:
> How can I get rid of "Warning: Undefined variable: user1(& password1) in
> C:\WebShare\wwwroot\netk\5\login.php on line 4" in that program?
>
> <?php
> include ("config.php");
> session_register("userpassword");
> if($user1==$USER && $password1==$PASSWORD) {
> $userpassword = $user1.$password1;
> header("Location:index.php");
> exit();
> }
> ?>
> <HTML>
> <HEAD>
> <TITLE>login</TITLE>
> <HEAD>
> <BODY>
> <FORM action="<? echo $PHP_SELF ?>" method="POST">
> <TABLE border="0" width="400">
> <TR>
> <TD>account£º
> <INPUT type="text" name="user1">
> <TD>password£º
> <INPUT type="password" name="password1">
> </TD>
> </TR>
> <TR>
> <TD>
> <INPUT type="submit" value="login">
> <INPUT type="reset" value="cancel">
> </TD>
> </TR>
> </TABLE>
> </FORM>
> </BODY>
> </HTML>
>
>
>