NICK NICK - 11 months ago 56
HTML Question

PHP varible in html

Hello guys I have this html code with php variable the text will be display in color black but I don't know how to make the variable to be in color red

here is the code

<br>Your Intrest Rate is: ".$interest_rate."%\n<br>

when I do

<br>Your Intrest Rate is: ".<a color=red>$interest_rate</a>."%\n<br>

the page stopps working

how can I do this please advise ?

Answer Source

I cannot see PHP tags or PHP code, but assuming this is a string inside PHP tags (since there is no problem without the anchor tag), your problem is the HTML tags outside the string.

Do this:

<br>Your Intrest Rate is: <span style='color:red'>".$interest_rate."%</span><br>