0

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!

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.