SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member phpknowhow's Avatar
    Join Date
    May 2007
    Location
    US
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Make Dynamic Star Rank System

    Ok, here is what Im looking for:

    I want to be able to rank hosts (http://www.find-hosting-deals.com/hosts/) by them clicking on star images.

    image: star, star, star, star, star
    rank: 1, 2, 3, 4, 5

    I have two images: darkstar.gif and lightstar.gif. I want each star (of the 5 total) to light up as a user rollsover them. This means that when a user rolls over the 3rd star, the 1st, 2nd, and 3rd all change from lightstar.gif to darkstar.gif (each previous star). I also want it to display the actual rank when a user is not rolling over them. Currently all I have is a php script:

    PHP Code:
    $rank=floor($host['plan_rank']);
        for(
    $i=0;$i<$rank;$i++) {
        echo 
    "<img src=\"".SITE_URL."images/darkstar.gif\">";
        }
        for(
    $i=0;$i<(5-$rank);$i++) {
        echo 
    "<img src=\"".SITE_URL."images/lightstar.gif\">";
        } 
    There doesn't need to be any form actions or special a tags. I was just going to have each star linked to a page like rank.php?rank=[1-5].

    Any ideas where I should start?
    PHP Know How | Find-Hosting-Deals.com: Compare hosting plans

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    These are all client-side effects you're looking for, so JavaScript is the answer.


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
  •