Re: How to ovoid Undefined Variable error
| From: | Get Now | Date: | Mon, 30 Oct 2000 03:44:41 +0000 |
| Subject: | Re: How to ovoid Undefined Variable error | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22602@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "Lars Torben Wilson" <torben@pinc.com>
To: "Get Now" <get_now@hotmail.com>
Cc: <php-general@lists.php.net>
Sent: Sunday, October 29, 2000 10:21 PM
Subject: Re: [PHP] How to ovoid Undefined Variable error
> Get Now writes:
> > Folks,
> >
> > I have Contact request check box in an .html form. When I validate
this
> > form in .php, I get a Warning saying that Contact request variable
is
> > undefined.
> >
> > I get this warning only when I don't select the check box or when I
> > initialize these variable in my global.php file. I also have
> > error_reporting(15) in .PHP.
> >
> > What is the best way to ovoid this problem?. Thanks in advance.
> >
> > regards,
> > SK
>
> Initialize the variable to something before you either check its value
> or assign it to something else. That way, you can also check it
> against this default value to see whether its corresponding checkbox
> was checked.
>
I tried, but no luck :-(, Now the warning is moved from line 3. to line
1 as expected. the line where I initialized to temp.
Ex:
1. $Temp=$Contact;
2. $Contact=$Temp;
3. If($Contact)
4. {
..
}
regards,
SK