Basically i'm making a function to display rating images like so...
function displayRating($rating)
{
// function action here
}
where the $rating variable is will refer to the rating (0 to 5) (e.g. displayRating(3)). I have this code for my rating images...
$rating0 = "<img src=http://www.htmlforums.com/archive/index.php/\"http://www.windowsforums.net/images/rating0.gif\">";
$rating1 = "<img src=http://www.htmlforums.com/archive/index.php/\"http://www.windowsforums.net/images/rating1.gif\">";
$rating2 = "<img src=http://www.htmlforums.com/archive/index.php/\"http://www.windowsforums.net/images/rating2.gif\">";
$rating3 = "<img src=http://www.htmlforums.com/archive/index.php/\"http://www.windowsforums.net/images/rating3.gif\">";
$rating4 = "<img src=http://www.htmlforums.com/archive/index.php/\"http://www.windowsforums.net/images/rating4.gif\">";
$rating5 = "<img src=http://www.htmlforums.com/archive/index.php/\"http://www.windowsforums.net/images/rating5.gif\">";
So I want to put this into the function but I don't know how.you could just do something like
function displayRating($rating)
{
echo "<img src=http://www.htmlforums.com/archive/index.php/\"http://www.windowsforums.net/images/rating" . $rating . ".gif\">";
}This will work, thanks. I'm at college now, I'll try this when I get home.
function displayRating($rating)
{
// function action here
}
where the $rating variable is will refer to the rating (0 to 5) (e.g. displayRating(3)). I have this code for my rating images...
$rating0 = "<img src=http://www.htmlforums.com/archive/index.php/\"http://www.windowsforums.net/images/rating0.gif\">";
$rating1 = "<img src=http://www.htmlforums.com/archive/index.php/\"http://www.windowsforums.net/images/rating1.gif\">";
$rating2 = "<img src=http://www.htmlforums.com/archive/index.php/\"http://www.windowsforums.net/images/rating2.gif\">";
$rating3 = "<img src=http://www.htmlforums.com/archive/index.php/\"http://www.windowsforums.net/images/rating3.gif\">";
$rating4 = "<img src=http://www.htmlforums.com/archive/index.php/\"http://www.windowsforums.net/images/rating4.gif\">";
$rating5 = "<img src=http://www.htmlforums.com/archive/index.php/\"http://www.windowsforums.net/images/rating5.gif\">";
So I want to put this into the function but I don't know how.you could just do something like
function displayRating($rating)
{
echo "<img src=http://www.htmlforums.com/archive/index.php/\"http://www.windowsforums.net/images/rating" . $rating . ".gif\">";
}This will work, thanks. I'm at college now, I'll try this when I get home.