Re: PHP Notice: Undefined variable
| From: | Marek Kilimajer | Date: | Sat, 04 Oct 2003 13:47:31 +0000 |
| Subject: | Re: PHP Notice: Undefined variable | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165034@lists.php.net to get a copy of this message | ||
Andrew Chernyack wrote:
I recommend the next variant
if ($_POST["msg"] =="hi")
Why?
I've created an html file with form's action parameter as info.php that
contains phpinfo().
The result was
PHP_SELF /~adolf/info.php
_POST["a"] dv fdsvz
_SERVER["CONTENT_LENGTH"] 10
You see, _POST["a"]
That does not matter, both 'a' and "a" are strings.
This solves it:
if(isset($_POST['msg']) && $_POST['msg']=='hi') {
// do something
}