Reputation: 1156
I'm currently trying dynamically create an html table in PHP. Further, I want the first two lines to be a different color. The solution I see is to give them a class and then use css to color the lines.
if ($count<=2){
echo "<tr> class='color'";
}else
echo"<tr>";
//other code
echo"</tr>";
Problem is my code prints out the words "class='color'"
Does anyone know why this is happening? Thanks!
Upvotes: 0
Views: 103
Reputation: 2871
Of course. What is this
echo "<tr> class='color'";
instead of
echo "<tr class='color'>";
?
No offense intended, but try checking the plain HTML code before turning it into something dynamic.
Upvotes: 4