> ----- Original Message ----- > From: "Erich Beyrent" <[EMAIL PROTECTED]> > To: "Sunfire" <[EMAIL PROTECTED]> > > > > > hi.. > > > > > > 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 }
Eesh! I think you mean: if (isset($ac2) && isset($ext2) && isset($num2)) { do something } And, depending on what sort of form field it is, isset() might not be a very good test anyway! Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php