What I would like to do is display an image instead of a number in my page.
That is to say I have a little form which has a select box from 0 - 9.(there are other fields)
This puts the input into a MySQL db, I have also created 10 little gif images (yes, you got it they're stars, but this is not a poll or voting script) which I have placed in a directory of their own, this will not change.
And what I would like to do is instead of printing the number 2 is to put the 2star gif in its place.
I have looked everywhere and all I've found is poll or voting scripts which do net exactly help me, thanks in advance.
using images
Moderator: General Moderators
Code: Select all
<?php
if($number == 2) { print"<img src="images/2star.gif">"; }
?>or better yet:
Code: Select all
<?php
print"<img src="images/{$number}star.gif">";
?>Once again thank you for your help and I hope that you can still help me out.....
Now :
works for an image on the page but
how would I use that in a table as the background image ???
I have used both print and echo and they didn't seem to work but its most probably me and my bad syntax!!!!
Now :
Code: Select all
<?php
print"<img src="images/{$number}star.gif">";
?>how would I use that in a table as the background image ???
I have used both print and echo and they didn't seem to work but its most probably me and my bad syntax!!!!
Code: Select all
<?php
echo <<< END
<table cellpadding="0" cellspacing="0" border="0" style="background:url({$number});">
<tr><td>
it's the background!!
</td></tr>
</table>
</table>
END;
?>-Nay