isset(checkbox) vs. isset(text)
| From: | Johan Ekenberg | Date: | Sun, 20 Feb 2000 23:02:06 +0000 |
| Subject: | isset(checkbox) vs. isset(text) | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-10530@lists.php.net to get a copy of this message | ||
Hi!
It appears that a named input field of type "text" will always
set a $GLOBALS[]variable in PHP4 (even if it's empty), while a
named checkbox will only set the corresponding $GLOBALS[] variable
if it is checked.
--
<INPUT TYPE='text' NAME='text' VALUE=''> // empty
<INPUT TYPE='checkbox' NAME='checkbox' VALUE='1'> // unchecked
--
When submitting the above, both formfields empty/unchecked,
this will be the result in PHP:
isset($GLOBALS[text]); // = true
isset($GLOBALS[checkbox]); // = false
Is it meant to be this way?
If so, could somebody please explain why?
I find the above behaviour inconsistent, but perhaps
I'm missing the obvious reason?
In my mind any named form field should be returned as a
set variable regardless of whether it has a value or not.
/Johan Ekenberg