Jump to content

Help Please! If Else Statment


Travist6983

Recommended Posts

Hey there fellow PHP coders I am sorta a newbie with php but i am having a heck of a time with this If Else statement and i know someone with experience will be able to tell me why the else if is not working

 

What this is here is on our company intranet our agent love to send out flyers without picture and makes us look bad... so this is an IF Else if there is a picture display the eFlyer options else dont display the flyer options

 

If doesnt seem to do the else can anyone see something that i am not seeing i have been staring at it for 2 hours now trying different little things and havent been able to get it to work

 

PLEASE PLEASE help me thanks for everyone who reads this

 

<?php  
if( $mlsInfo['PhotoURL'] != "")

echo "<a href='emailListing.php?type=rs&mlsn=".$propInfo['MLSNumber']."' target='_blank' onMouseOver='doTooltip(event, 0)' onMouseOut='hideTip()' ><img src='images/buttons/fb_eListing.gif' width='106' height='20' border='0'></a>    

<a href='emailPostcard.php?type=rs&mlsn=".$propInfo['MLSNumber']."' target='_blank' onMouseOver='doTooltip(event, 2)' onMouseOut='hideTip()' ><img src='images/buttons/fb_ePostcards.gif' width='106' height='20' border='0'></a>    

<a href='emailFlyer.php?type=rs&mlsn=".$propInfo['MLSNumber']."' target='_blank' onMouseOver='doTooltip(event, 3)' onMouseOut='hideTip()' ><img src='images/buttons/fb_Flyer.gif' width='110' height='20' border='0'></a>    

<a href='../print_rs.php?type=rs&mlsn=".$propInfo['MLSNumber']."' target='_blank' onMouseOver='doTooltip(event, 5)' onMouseOut='hideTip()' ><img src='images/buttons/fb_printFlyer.gif' width='106' height='20' border='0'></a>    

<a href='fb_propertyRS_print.php?type=rs&mlsn=".$propInfo['MLSNumber']."' target='_blank' onMouseOver='doTooltip(event, 4)' onMouseOut='hideTip()' ><img src='images/buttons/fb_printListing.gif' width='106' height='20' border='0'></a>    
			";	
else
echo "You Dont have any photos please add some";	
			?>

Link to comment
Share on other sites

Although your problem is not related to this, I always enclose the code blocks associated with a condition within brackets to make it easier to read/debug. The first echo statement above spans multiple lines which should be easily misinterpreted which could add additional time when debugging. I'd format the code like this:

if( $mlsInfo['PhotoURL'] != "")
{
    echo "<a href='emailListing.php?type=rs&mlsn=".$propInfo['MLSNumber']."' target='_blank' onMouseOver='doTooltip(event, 0)' onMouseOut='hideTip()' ><img src='images/buttons/fb_eListing.gif' width='106' height='20' border='0'></a>    
          <a href='emailPostcard.php?type=rs&mlsn=".$propInfo['MLSNumber']."' target='_blank' onMouseOver='doTooltip(event, 2)' onMouseOut='hideTip()' ><img src='images/buttons/fb_ePostcards.gif' width='106' height='20' border='0'></a>    
          <a href='emailFlyer.php?type=rs&mlsn=".$propInfo['MLSNumber']."' target='_blank' onMouseOver='doTooltip(event, 3)' onMouseOut='hideTip()' ><img src='images/buttons/fb_Flyer.gif' width='110' height='20' border='0'></a>    
          <a href='../print_rs.php?type=rs&mlsn=".$propInfo['MLSNumber']."' target='_blank' onMouseOver='doTooltip(event, 5)' onMouseOut='hideTip()' ><img src='images/buttons/fb_printFlyer.gif' width='106' height='20' border='0'></a>    
          <a href='fb_propertyRS_print.php?type=rs&mlsn=".$propInfo['MLSNumber']."' target='_blank' onMouseOver='doTooltip(event, 4)' onMouseOut='hideTip()' ><img src='images/buttons/fb_printListing.gif' width='106' height='20' border='0'></a>    
          ";
}
else
{
    echo "You Dont have any photos please add some";
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.