SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2000
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey again.
    i've got a small query regarding 'rating a site'.
    What I would like to do, is allow a user to rate the site on teh scale of 1 to 10.

    So, for example, I ask the user:
    How do you rate my site? [ a list box goes here with 1-10 values].

    Now, when I get the variable with the result of what they selected, lets say I called it $ratesiteresult (so if I chose 10/10, the value would be 10).

    What I want to do, is echo a certain image the amount of times that the value of $ratesiteresult is.

    So, if $ratesiteresult is 5, echo "<img src=star.gif"; ten times...
    and if it was 10, echo teh image ten times.. etc.

    I know this could be done as :
    if ($ratesiteresult == 1) {
    echo it once
    } elseif $ratesiteresult == 2) {
    echo it twice
    } etc etc.

    but what is the best php way of executing this. e.g. a for statement?
    Thanks for your help.
    AJ

  2. #2
    SitePoint Zealot
    Join Date
    Jul 2000
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no-one?
    Can't be that hard, can it?!!!

    -aj

    freddy/louie?!!!

  3. #3
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, it's not hard at all, just people (or I) don't look into the thread

    Yes, for loop is the best way to deal with this:
    PHP Code:
    for ($i=0;$i<$ratedValue;$i++)
    { echo(
    "*");

    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy


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
  •