Forum Moderators: coopster
line 52 is:
$table .= "<tr><td class="$class">$arr_value</td></tr>";
here is the code i am using to make the rows alter in color
<?
echo<<<EOF
<!DOCTYPE html PUBLIC " -//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" ><html>
<head>
<title>Title Here</title>
<style type="text/css">
td.RowOne {
background-color: #bfd9ff;
border: 1px solid #000000;
}
td.RowTwo {
background-color: #e8e8e8;
border: 1px solid #000000;
}
</style>
EOF;
//Build the array
$array = array("value1", "value2", "value3", "value4", "value5");
//Set the Rows
$class1 = "RowOne";
$class2 = "RowTwo";
$class = $class1;
//Start the table
$table = "<users>";
//Loop through the array
foreach($array as $arr_value){
$table .= "<tr><td class="$class">$arr_value</td></tr>";
if($class == $class1){
$class = $class2;
} else {
$class = $class1;
}
}
$table .= "</users>";
//echo the table
echo $table;
?>
"users" is my table name
any help wud be gud :)