Hi,
When I display records from database on html forms, the records should appear in alternate colors? How can I do this?
Thanks.
Jc
check the coding forum faq it's in there
$bg1 = "red"; /* You can use Hexs here too */ $bg2 = "blue"; $curBg = $bg1; for($i = 0; $i < 10; $i++) { echo $curBg; $curBg = ($curBg == $bg1) ? $bg2 : $bg1; }
Very simple code from my script:
$num=1; while($mess_array=mysql_fetch_array($mess_list)) { if($num%2==0) $bgcolor="#F2F2F2"; else $bgcolor="#FFFFFF"; print $bgcolor."<br>"; }