I’m trying to make every second TD in my TABLE (html) another color, and therefore I am using this variable:
$bgColor = ($bgColor == "#eee") ? "#fff" : "#eee";
And then I’m calling it in my table:
<td style='background:<?=$bgColor;?>'></td>
But then I get an error: Undefined variable with the $bgColor = ($bgColor etc.);
It’s working, but I get that error.
How would I fix this? Normally I’ve get this error when I’ve forgot an if(isset()); but thats not the situation here.
Thanks in forward 🙂
1 Answer