Re: Create variables with IF staements
| From: | Matt McClanahan | Date: | Wed, 13 Dec 2000 00:29:25 +0000 |
| Subject: | Re: Create variables with IF staements | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29992@lists.php.net to get a copy of this message | ||
On Tue, 12 Dec 2000, David Smith wrote:
> I am trying to assign a variable from the result of an IF statement. How an
> I do this in php? I have a field called FileImageURL which houses nopic.jpg
> if no picture is there and if there is a picture it returns apicture.jpg. I
> want it to display an image called jpg.gif if there is a picture and
> blank.gif if there isn't. I want to insert the result as a variable in my
> tables as $Image. Any suggestions?
>
> David Smith
>
> ///////
>
> $Image = result of below...
>
> ///////
>
> if($FileImageURL=="nopic.jpg")
> {
> echo "<IMG SRC=\"/home/warbirds/images/blank.gif\"
> BORDER=\"0\">";
> }
> else
> {
> echo "<IMG SRC=\"/home/warbirds/images/jpg.gif\"
> BORDER=\"0\">";
> }
> endif
if ($FileImageURL == 'nopic.jpg')
{
$Image = '<IMG SRC="/home/warbirds/images/blank.gif"
BORDER="0">';
}
else
{
$Image = '<IMG SRC="/home/warbirds/images/jpg.gif"
BORDER="0">';
}
echo $Image;
Matt