RE: [PHP] checking status of a HTML checkbox
| From: | Larry Brown | Date: | Fri, 10 Jan 2003 16:33:53 +0000 |
| Subject: | RE: [PHP] checking status of a HTML checkbox | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131139@lists.php.net to get a copy of this message | ||
Also look at empty(). I don't know if the $_POST array will send the key if
it as no variable. I know on a regular post it does send the variable, but
it has no value. I have used isset with just receiving post data and got
strange results. On one I had an isset statement that ran a result that
bypassed some code. When is submitted the form I got results as if the
isset was being executed and the code was skipped. Just to make sure this
was the case, I added echo "hello"; on the first line of the isset bypass
coding and after running the script I got the results without the bypass. I
took the hello back out and it bypassed! So adding the hello statement
affected whether isset gave a positive or negative response. The variable
isset was checking in this case was not being sent with a value. I changed
to empty() and got the result I was looking for. If $_POST sends the key
but not a value when you submit the form without a value assigned to the
variable then isset may not always work.
Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388
-----Original Message-----
From: Shams [mailto:shamskhanmalik@hotmail.com]
Sent: Friday, January 10, 2003 4:36 AM
To: php-general@lists.php.net
Subject: Re: [PHP] checking status of a HTML checkbox
thanks a lot, thats what I was looking for
:o)
Shams
"- Edwin" <copperwa11s@yahoo.co.jp> wrote in message
news:JO20030110183105.27443796@yahoo.co.jp...
> "Shams" <shamskhanmalik@hotmail.com> wrote:
>
> [snip]
> > At the moment I am doing this:
> >
> > if ( $_POST["insurance"] == "yes" )
> > {
> > }
> >
> > But is there a more "accurate" way of checking the exsistence of
> > "insurance"?
> [/snip]
>
> I think you're looking for isset():
>
> http://www.php.net/manual/en/function.isset.php
>
> - E
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php