I want a system where the username change with their rating.
I created a if - else if block to store different colorvalues in a variable like:
if (rating = 1) { $usrcolor='#FFFF444'; }
the if block is working... if i echo the $usrcolor variable it shows the correct #?????? value.
Now i want to do something like:
echo "<p style=\"font-color:$usrcolor; \">$username</p>";
but I cannot get it to work.
I think I messed up with the " or forgot some dot (like .$xxx)...
I tried alot of different ways to echo it but either i get it in black color or it wont echo at all..
please help I'm getting seriously frustrated heh.
Thanks
(Solved) ..echo a text with a color stored in a variable?
Moderator: General Moderators
(Solved) ..echo a text with a color stored in a variable?
Last edited by hybris on Fri Oct 25, 2013 9:29 am, edited 1 time in total.
Re: How do you echo a text with a color stored in a variable
Solved it myself 
echo "<span style=color:$namecolor class=\"label-$username\">$username</span>";
echo "<span style=color:$namecolor class=\"label-$username\">$username</span>";