Re: Handling checkboxes that aren't checked!!!
| From: | Rob Adams | Date: | Tue, 04 Nov 2003 22:18:06 +0000 |
| Subject: | Re: Handling checkboxes that aren't checked!!! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-168510@lists.php.net to get a copy of this message | ||
All these posts as replies that are not linked to the originals (and
sometimes show up timewise BEFORE the original!) throw me off. I'll try to
not answer already answered questions anymore.
-- Rob
"Rob Adams" <rob_adams@hotmail.com> wrote in message
news:20031104221555.5965.qmail@pb1.pair.com...
>
> "Kb" <kevin@bland99.freeserve.co.uk> wrote in message
> news:20031104204021.65051.qmail@pb1.pair.com...
> > Hi,
> >
> > I have a page with a Form and a Checkbox.
> >
> > I have a second page which wants to do something depending on if the
> > checkbox is selected or not.
> > If its selected there is no problem. But if I tryand do anything if it
> > isn't selected then it says the variable is 'undefined'. How can I test
> for
> > it without getting an error if it is not checked?? Or is there a way of
> > ensuring it is either "on" or "off".
>
> There may be some way in JavaScript to ensure a value, but the easiest way
> is to use:
> isset()
> or
> empty().
>
> php.net/isset
>
> -- Rob
>
> >
> > if ($want_it == TRUE {
> > echo "Selected"; }
> > else {
> > echo "Not Selected";}
> >
> > Will give an undefined eror if the checbox is not selected, but works if
> it
> > is selected.
> >
> > I have been tearing my hair (what is left) out over the past week and I
> > could really do with some help.
> >
> > Suggestions??
> >
> > Thanks in advance
> >
> > Kevin
>