2 Replies Latest reply: Jan 26, 2012 4:14 AM by whatalotofrubbish RSS

    How do you replace one image with another

    whatalotofrubbish Community Member

      I have a page that displays the results of a search for information about a club. One of the items is the club's logo. It is displayed using the following code

       

      <img src="<?php echo $row_clubedit['club_logo_url']; ?>" alt="The Club's Logo"  class="logo" title="The Club's Logo">

       

      This works fine, except when no club has been selected, in which case it shows the default question mark in a blue box.

      It would be nice if I could display the Federation Logo, to which all the clubs belong, until a club is picked.

      Is there a simple way to set a default image that would be replaced from a data set.

      $row_clubedit['club_logo_url'] holds the url to the log in the format http://www.club.org/clublogo.png

      <img src="<?php echo ( 'federation_logo_url'); ?>" alt="The Club's Logo"  class="logo" title="The Club'c Logo">

       

      The logic I suppose would be

       

      if club_logo_url does not exist,

                then print the  federation logo,

           else print the club logo.

       

      How do you code that in php?

      I'm only a beginner at PHP.