!empty statement not getting the response I anticipated
<p>I have a call from another page and it is returning photos within a JavaScript slide show, however, I needed to add a message to pop up if there were no photos for that item.I keep getting a error, I am not quite sure what is wrong with my logic..if i add </p>

<pre><code>        if(!empty($photo)){
          print '&lt;div class="nophoto"&gt;There are no photos for item &lt;/div&gt;'; 
    }
</code></pre>

<p>I will get my message but if i click on a item with photos than the message  will appear for a brief second,when the photos populate the slide show.</p>

<pre><code>  &lt;?php
   echo '&lt;div class="container"&gt;';
   foreach($value as $photo=&gt;$pictures){
    if(isset($_GET['PhotoVal'])){
      if ($_GET['PhotoVal'] == $photo){
              if(empty($photo)){
             print '&lt;div class="nophoto"&gt;There are no photos for this item&lt;/div&gt;';
            }
           else
        echo '&lt;div class="flexslider"&gt;&lt;ul class="slides"&gt;';
      foreach($pictures as $picture){                               
        echo '&lt;li&gt; &lt;img src="photos/'.$picture.'" /&gt;&lt;/li&gt;' ;         
     }
    echo'&lt;/ul&gt;&lt;/div&gt;&lt;a class="close"href="javascript:closeWindow();"&gt;Back to Map&lt;/a&gt;';
    }
   }
  }

    echo '&lt;/div&gt;';
 ?&gt;
</code></pre>
