Iam Coding A Small Portal And Need Help

This Is My Code

echo "<div class='posterdecoration'><img src='$row[scr1]' width='640' alt='$row[name]' /></div>";
echo "<div class='posterdecoration'><img src='$row[scr2]' width='640' alt='$row[name]' /></div>";

When I Put Scr1 + Scr2 From Site Panel

It Show On The Site

I Need To Use <If Condition>

On The Scr2

So If I Didnt Put The Field Scr2 It Dont Appear

I Used To Made It In vBulletin Forum

<If Condition="#post[field10]"> Something </if>

But Here In My Code I Dont Know How To Do It

All I Need To Do Is If The $row2 Is Empty Dont Show It In The Page

Try this:

echo "<div class='posterdecoration'><img src='$row[scr1]' width='640' alt='$row[name]' /></div>";
echo (isset($row['scr2'])) ? "<div class='posterdecoration'><img src='$row[scr2]' width='640' alt='$row[name]' /></div>" : NULL;

bye :)

commented: Thanks For Reply Plz Continue With Me +2

First Thanks Sir For Reply

After Edit

When I Add Only Scr1

And Leave Scr2 Empty

The Field Appear But With No Image Inside It

I Need The Whole Class Not Appear If $Row2 It Empty

I Mean I Dont Want This To Appear

<div class='posterdecoration'>

Try this

if($row[scr1]!="")
{
echo "<div class='posterdecoration'><img src='$row[scr1]' width='640' alt='$row[name]' /></div>";
}
if($row[scr2]!="")
{
    echo "<div class='posterdecoration'><img src='$row[scr2]' width='640' alt='$row[name]' /></div>";
}
commented: You Are Amazing Thanks So Much +2

You Are Amazing Thanks So Much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.