SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2001
    Location
    UK
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    images not working

    Hey,

    i'm trying to make a rating type script, where a value is converted to a certain image and displayed at the end of each post. I've been guessing how to display a different image for a different value, and it's not working - all the posts have the same image posted.

    Could someone tell me how to seperate the images for each post please?



    PHP Code:
    echo "<tr>"

    if (
    $reviewvalue==1) { 
    echo 
    "<td><img src=\"http://www.address.com/images/arrow.gif\">"
    }

    if (
    $reviewvalue==2) { 
    echo 
    "<td><img src=\"http://www.address.com/images/arrow2.gif\">"
    }

    echo 
    "</tr>"

  2. #2
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looks like it should do what you intend... make sure the value of $reviewvalue is being made what you intend it to be... perhaps throw in echo($reviewvalue); to see if it is ever being assigned to 2. If it isn't, then it is probably the form that probably doesn't work the way you intend.
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  3. #3
    SitePoint Addict IsaacV's Avatar
    Join Date
    Jan 2002
    Location
    Saint Petersburg
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: images not working

    PHP Code:
    $arrow "<td><img src=\"http://www.address.com/images/arrow.gif\">";
    $arrow2 "<td><img src=\"http://www.address.com/images/arrow2.gif\">";

    echo 
    "<tr>"
    if (
    $reviewvalue==1) { 
    echo 
    "$arrow"
    }
    if (
    $reviewvalue==2) { 
    echo 
    "$arrow2"
    }
    echo 
    "</tr>"
    ?
    Pants.
    Join the NYFlava Fashions Contest


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •