tags:

views:

28

answers:

1

Hi all, 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!

+4  A: 

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.

Scorchio