Parse error in echo with php -
the error saying parse error: parse error in line, checkbox line in code below:
<?php if ($_session['something']=='1'){ echo '<tr> <td> '.$lang['form_label_users_disable'].' </td> <td> <input type="checkbox" '.(if($row['active'] == "0"){echo 'checked = "yes"';}).' name="disable" value="0" ><br> </td> </tr>'; } ?>
alternatively, can insert ternary operation inside echo. consider example:
<?php if($_session['something']=='1') { echo '<tr> <td>'.$lang['form_label_users_disable'].'</td> <td> <input type="checkbox" '.(($row['active'] == "0") ? 'checked=checked' : '').' name="disable" value="0" ><br> </td> </tr>'; } ?>
note: need use proper attribute:
checked="checked"
orchecked
Comments
Post a Comment