I'm really confused with something I never had any problems with
before... I have a form with a textbox called password. On the second
page that $password is posted to, if I test isset($password ) after a
submit, it always evaluates to true, regardless of whether or not
anything was entered into the textbox... echoing the value simply echoes
its contents, which is an empty string. If I test for simply
if($password), however, that does evaluate to false. This doesn't work
in all cases, however, since sometimes it will give an error saying the
variable is not defined (cases in which I've always used isset to test).
I read up on isset() on php.net, and it says that it will return false
if a variable has been set to null... is that not the case here? If
anyone could tell me exactly what type of situation calls for each of
these two methods I would really appreciate it, thanks in advance.
Marcus
before... I have a form with a textbox called password. On the second
page that $password is posted to, if I test isset($password ) after a
submit, it always evaluates to true, regardless of whether or not
anything was entered into the textbox... echoing the value simply echoes
its contents, which is an empty string. If I test for simply
if($password), however, that does evaluate to false. This doesn't work
in all cases, however, since sometimes it will give an error saying the
variable is not defined (cases in which I've always used isset to test).
I read up on isset() on php.net, and it says that it will return false
if a variable has been set to null... is that not the case here? If
anyone could tell me exactly what type of situation calls for each of
these two methods I would really appreciate it, thanks in advance.
Marcus
Comment