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" or checked


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -