Reputation: 2227
for($i=0; $i<5; $i++) {
switch($i) {
case 0:
echo "<div class=\"darkgrey topdarkgrey\">";
break;
case 1:
case 3:
echo "<div class=\"lightgrey\">";
break;
case 2:
case 4:
echo "<div class=\"darkgrey\">";
break;
case 5:
echo "<div class\"darkgrey bottomdarkgrey\">";
break;
}
if($i=$idagInt)
echo "<div id=\"idag\">" . $dag[$i] . "<br>";
else
echo "<div class=\"dag\"><span class=\"veckoDag\">" . $dag[$i] . "</span><br>";
echo "<span class=\"month\">" . $datumDay[$i] . " " . $month[$i] . "</span></div>";
echo "<div class=\"mat\">" . strip_tags($mat[$i], "<p>") . "</div></div>";
}
This is the code I'm using to print things to the website and after some trouble-shooting my conclusion is that there's something wrong with the switch-statement, but I cant see what?
Upvotes: 0
Views: 112
Reputation: 219834
Here's your problem. You're assigning $i
the value of $idagInt
rather then comparing it. As a result $i
never reaches 5.
if($i=$idagInt)
Change it to:
if($i==$idagInt)
Upvotes: 7