If(!empty($member['Areacode2']) || !empty($member['Exchange2']) || !empty($member['Number2'])) { echo $member['Areacode2'] . '-' . $member['Exchange2'] . '-' . $member['Number2']; }
The mail wrapping will mess that up, but hopefully you get the idea. You're looking for Areacode2 OR Exchange2 OR Number2 being NOT (that's what the ! is for) empty. If any of them are not empty, then you print out their values. If you only want it displayed if all of them are NOT empty, then change the || (which means OR) to && (which means AND). A single & means a bitwise AND, which you don't want to mess with. Hope that helps. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ > -----Original Message----- > From: Sunfire [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 06, 2003 12:02 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] empty and isset > > ok i dont know if this will help at all since the code that doesnt work > wont > fit in the message (got error saying i cant send that much all at once) > this > is what i got out of var_dump.. > first set of variables: > $member[Areacode1]=string(3)"123" 123 > $member[Exchange1]=string(3)"123"123 > $member[Number1]=string(4)"1234"1234 > those variables im not worried about because they are required in the > form. > the next ones i want to exclude from the list all together if string()==0 > on > all 3 variables.. here is the var dumb from them: > $member[AreaCode2]string(0)"" > $member[Exchange2]string(0)"" > $member[Number2]string(0)"" > here is the seudo code for what i need to do: > if $member[AreaCode] & $member[Exchange2] & $member[Number2] is empty, > null > =="" or has string(0) in it { > //exclude vars from list alltogether > } > any other conditions{ > //print the vars in the list > } > > ----- Original Message ----- > From: "John W. Holmes" <[EMAIL PROTECTED]> > To: "'Sunfire'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, February 05, 2003 9:57 PM > Subject: RE: [PHP] empty and isset > > > > They both work, you're just not using the correct logic or something. > > Show your code again... your actual code that isn't working (so you say) > > and the form that's being submitted. Also, is register_globals on or > > off? > > > > Load this small bit of code as proof that it works: > > > > <form method="POST"> > > <input type="text" name="name"> > > <input type="submit"> > > </form> > > <? > > if(isset($_POST['name'])) > > { > > echo "You submitted a name "; > > if(empty($_POST['name'])) > > { echo "that was blank."; } > > else > > { echo "of {$_POST['name']}"; } > > } > > ?> > > > > ---John W. Holmes... > > > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > > today. http://www.phparch.com/ > > > > > -----Original Message----- > > > From: Sunfire [mailto:[EMAIL PROTECTED]] > > > Sent: Wednesday, February 05, 2003 8:08 PM > > > To: [EMAIL PROTECTED] > > > Subject: [PHP] empty and isset > > > > > > i tried to use empty and isset to check and see if variables were > > being > > > used > > > in a form.. im not getting any kind of good answer from the server > > when i > > > try using empty and isset... it all works the same and that is cut out > > > anything regardless of if it was used or not... > > > > > > > > > any thing to help? > > > the docs didnt seem to be much help and im sort of confused > > > > > > > > > > > > > > > --- > > > 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 > > > > > > > > > > -- > > 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/11/2003 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php