tags:

views:

154

answers:

3

What the heck is wrong with this:

if  ($bb[$id][0] == "bizz")  {
    $BoxType = "bus_box";
} else {
    $Boxtype = "home_box";
}
<div class="<? echo $BoxType; ?>">

$bb[$id][0] can either be 'bizz' or 'home' but no matter what it stops after the first step...

It is driving me crazy!

+10  A: 

PHP variables are case sensitive. The 'T' in $BoxType is lower case in the else block.

Tom Haigh
+5  A: 

Not entirely related to your question (which has already been answered), but you may be interested in the ternary operator :)

<div class="<?= $bb[$id][0] == "bizz" ? "bus_box" : "home_box" ?>">
Daniel
+1  A: 

Explain what you mean by "it stops after the first step". Tom is correct, $BoxType and $Boxtype are the not same variables, but it sounds like $BoxType is always getting "bus_box". If it were really "stopping after the first step", $BoxType would just be whatever it was initialized to in the event that $bb[$id][0] was "bizz" and $Boxtype would be "home_box".

Cameron