Hi
I'm a beginner to functions and I tried using the following to alternate the background color of rows with no luck. Can anyone hlep?
<?php
function backgroundColor() {
if ($bg == 'yes') {
echo '';
$bg = 'no';
}
elseIf ($bg == 'no') {
echo 'bgColor';
$bg = 'yes';
}
else {
echo 'error';
}
}
$bg = 'no';
?>
<style>
.bgColor {
color:gray;
}
</style>
<div class="<?php backgroundColor() ?>">
Row 1 content
</div>
<div class="<?php backgroundColor() ?>">
Row 2 content
</div>
<div class="<?php backgroundColor() ?>">
Row 3 content
</div>