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" <[EMAIL PROTECTED]> To: "Sunfire" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> 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