I am looking to incorporate background colors for alternating rows, with odd rows being #e5e8e8 and even rows being #b9b8bb, using CSS.
for ($i = 2; $i <= $arrayCount; $i++) {
$_SESSION["a"] = trim($allDataInSheet[$i]["A"]);
$_SESSION["b"] = trim($allDataInSheet[$i]["B"]);
$_SESSION["c"] = trim($allDataInSheet[$i]["C"]);
$_SESSION["d"] = trim($allDataInSheet[$i]["D"]);
$_SESSION["e"] = trim($allDataInSheet[$i]["E"]);
$_SESSION["f"] = trim($allDataInSheet[$i]["F"]);
$_SESSION["g"] = trim($allDataInSheet[$i]["G"]);
echo '<!-- table content - start --> ';
echo ' <!-- ROW 1 -->';
echo '<tr>';
// table cells and content here
echo '</tr>';
}
I am trying to dynamically add background colors of #e5e8e8 for odd rows and #b9b8bb for even rows in PHP within a for loop. The table code provided is for an Email template and contains many divs and tables, making it difficult to implement the ODD and EVEN options effectively. Any suggestions on how to achieve this would be greatly appreciated. Thank you.