need your kind help here. So as the title suggest, I'm trying to change css classes using PHP variable. So basically I want to create a loop that echos some code. But I want the div class in the first loop to be different -- it should be hidden.
Here's the simplified code I made to make the problem clear. I don't know where the mistakes are. Please advise.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
.hidden {
visibility:hidden;
}
.visible {
visibility:visible;
}
.firstclass {
color:red;
}
</style>
</head>
<body>
<?php
$case = 4;
$page = "";
$class = "";
if ($page == 0) {
$class = "hidden";
}
else {
$class = "visible";
}
for ($page = 0; $page < $case; $page++) {
echo "<div class = " firstclass $class " >This is page $page <br /></div>";
}
?>
</body>
</html>