Re: Re: [PHP] empty variables from a form
| From: | Kevin Stone | Date: | Wed, 05 Feb 2003 21:06:58 +0000 |
| Subject: | Re: Re: [PHP] empty variables from a form | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-134487@lists.php.net to get a copy of this message | ||
Okay enough of this. Please show us some code. :-)
-Kevin
----- Original Message -----
From: "Sunfire" <rusty_81@msn.com>
To: <php-general@lists.php.net>
Sent: Wednesday, February 05, 2003 2:10 PM
Subject: Re: Re: [PHP] empty variables from a form
> empty doesnt work either... it still comes up as though something is in
them
> and excludes either nothing at all or includes everything...even the empty
> vars..any reason for that ?
>
>
> ----- Original Message -----
> From: "1LT John W. Holmes" <holmes072000@charter.net>
> To: "Sunfire" <rusty_81@msn.com>; <php-general@lists.php.net>
> Sent: Wednesday, February 05, 2003 2:43 PM
> Subject: Spam: Re: [PHP] empty variables from a form
>
>
> >
> > > > > how would you test for an empty (unused) variable from a form..
> > > > > i have a phone number split into 3 different vairiables and want
to
> > test
> > > > to
> > > > > see if they were used in the form before displaying either the
phone
> > > > number
> > > > > itself or just leaving it out of the display... what code would be
> > good
> > > to
> > > > > test it with.. the variables are $ac2 $ext2 and $num2
> > > >
> > > > Use the isset() function:
> > > >
> > > > if(isset($ac2)) and
> > > > if(isset($ext2)) and
> > > > if(isset($num2)) { do something }
> > > > else { do something else }
> >
> > That's not a good idea if your trying to check for an empty variable. An
> > empty text box, when submitted, will still be set and pass isset(). You
> > should use empty() is that's really what you're looking for.
> >
> > ---John Holmes...
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>