I am trying to figure out how I should structure an if/else statement.
I understand the basic if/esle should be as follows;
<?php
if ($a > $b) {
echo "a is bigger than b";
} elseif ($a == $b) {
echo "a is equal to b";
} else {
echo "a is smaller than b";
}
?>
I'm not sure how to implement this logic into my current statement. I think because the php is mixed within html it's confusing me :/
I'm sure this is very wrong but could somebody please tell me how it should be structured?
<form role="form">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default <?php if ($status == '1' ) echo 'active btn-success' ; ?>">
<input type="radio" name="status" id="option1" value="1" autocomplete="off"> Active
</label>
<label class="btn btn-default <?php elseif ($status == '2' ) echo 'active btn-warning' ; ?>">
<input type="radio" name="status" id="option2" value="2" autocomplete="off"> Inactive
</label>
<label class="btn btn-default <?php else ($status == '3') echo 'active btn-danger' ; ?>">
<input type="radio" name="status" id="option3" value="3" autocomplete="off"> Not Found
</label>
</div>
</form>
The error I see in NetBeans is;
Syntax error: unexpected elseif
Can I or should I just use an if statement on each label?
elseif&else. Useifin each label.