Re: [PHP4BETA] isset(checkbox) vs. isset(text)
| From: | Paul McGarry | Date: | Mon, 21 Feb 2000 12:39:47 +0000 |
| Subject: | Re: [PHP4BETA] isset(checkbox) vs. isset(text) | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-10570@lists.php.net to get a copy of this message | ||
Johan Ekenberg wrote:
> 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.
> Is it meant to be this way?
Yes it is.
> If so, could somebody please explain why?
Because that is the way they designed it.?
http://www.w3.org/TR/html4/interact/forms.html#checkbox
>
> 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.
It comes down to what they call 'successful controls'
http://www.w3.org/TR/html4/interact/forms.html#successful-controls
I'm sure it makes sense to you that if you have multiple radio buttons of
the same name only the checked one gets sent through on form submission.
The same is true for checkboxes, though you can have more than on of them
with the same name that is successful.
I hope that helps somewhat...
Paul McGarry