Re: How to ovoid Undefined Variable error
| From: | Lars Torben Wilson | Date: | Mon, 30 Oct 2000 03:21:30 +0000 |
| Subject: | Re: How to ovoid Undefined Variable error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22600@lists.php.net to get a copy of this message | ||
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.
--
+----------------------------------------------------------------+
|Torben Wilson <torben@php.net> Netmill iTech|
|http://www.coastnet.com/~torben http://www.netmill.fi|
|Ph: 1 250 383-9735 torben@netmill.fi|
+----------------------------------------------------------------+