Tuesday, 6 August 2013

PHP if statements - I feel like an idiot

PHP if statements - I feel like an idiot

I have:
<input type="radio" id="flag" name="flag" value="0" <?php
if($row['flag_active'] === 0){ echo 'checked="checked"';}
?>checked="checked" /><label for="flag">Inactive</label>
<input type="radio" id="flag1" name="flag" value="1" <?php
if($row['flag_active'] === 1){ echo 'checked="checked"';}
?>checked="checked" /><label for="flag1">Active</label>
But the second radio button is the one that is always selected. I've
echoed out the $row['flag_active'] and it equals 0.
Also, I've tried:
if($row['flag_active'] === 0)
if($row['flag_active'] == 0)
if($row['flag_active'] = 0)
if($row['flag_active'] !== 1)
if($row['flag_active'] != 1)
Appreciate the help ahead of time.

No comments:

Post a Comment