Re: Not sure of my error

From: Date: Sat, 18 Nov 2000 00:43:21 +0000
Subject: Re: Not sure of my error
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25984@lists.php.net to get a copy of this message
Interesting, never used strlen for this reason before , does it work nicely? I am used to using empty() and isset() for such things. Joe, why do you always have to be so different? ;-) Wonderful how flexible this all is huh? At any rate, I would do this : <?php if (empty($state)) { echo 'Enter state please!'; } else { echo 'Your state was '.$state; } ?> I know that if $state were '0' then it is not considered empty, but this does not seem to apply here, right? Always looking for new little tips ... philip -- be outside the box. On Fri, 17 Nov 2000, Joe Stump wrote: > Try this: > > <? > > if(!strlen($state)){ > "dude enter a state!"; > }else{ > "you state was: ".$state; > } > > ?> > > --Joe > > > On Fri, Nov 17, 2000 at 04:11:17PM -0800, Jerry Lake wrote: > > For some reason the code below > > always returns as true even if > > there State == "whatever" It looks > > correct to me, but apparently isn't. > > <? > > if ($state == ""); > > { > > echo "<div align=center>"; > > echo "$state"; > > echo "<h3>Please enter a state name</h3>"; > > echo "</div>"; > > exit; > > } > > else > > { > > stuff > > } > > ?> > > > > Jerry Lake > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > ================================================================================ > = Joe Stump joestump98@yahoo.com > http://www.miester.org = > ================================================================================ > "Real programmers don't comment their code. > It was hard to write, it should be hard to understand." > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#25984) next »