Re: testing for blank var

From: Date: Thu, 21 Mar 2002 14:31:28 +0000
Subject: Re: testing for blank var
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-89503@lists.php.net to get a copy of this message
if (ereg("^[[:blank:]]*$",$img_url)) { // $img_url is blank } -- Julio Nobrega. Um dia eu chego lá: http://sourceforge.net/projects/toca Ajudei? Salvei? Que tal um presentinho? http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884 "Robert McPeak" <RMCPEAK@jhuccp.org> wrote in message news:sc99a571.096@ccp2.jhuccp.org... > if $img_url has a value, then I'd like to show the image, if it doesn't, > then I'd like to show a message. What's wrong with my code? Am I > incorrectly testing for the value? The else works fine, but not the if. > Thanks! > > if (!$img_url) > { > echo "<b>No Image URL Entered"</b><br>"; > } > else > { > echo "<img src=\"$img_url\">"; > } >

« previous php.general (#89503) next »