> > > 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