简单的PHP如果不工作

I'd like to combine this into an if else but whatever I am doing is breaking? Any ideas ? I am new to PHP. Would I would like to do is have the input changed based on the $perms being FALSE.

   <? if ($perms['user_profiles|edit_billable']===TRUE) { ?> 
    <div class="field">
        <label><?=l(273)?></label>
        <div class="input">
               <input type="checkbox" name="billable" value="1" data-bind="checked: userProfile().billable, disable:isBillable();">
        </div>
      </div>
    </div>
<? } ?>

   <? if ($perms['user_profiles|edit_billable']===FALSE) { ?>
    <div class="field">
        <label><?=l(273)?></label>
        <div class="input">
     <!-- This is where the else would go -->     
                <input type="checkbox" name="billable" value="1" data-bind="checked: userProfile().billable, enable:isBillable();">
        </div>
      </div>
    </div>
<? } ?>

Have you tried short syntax?

<?php if ($perms['user_profiles|edit_billable']): ?>
      <div class="field">
        <label><?=l(273)?></label>
        <div class="input">
               <input type="checkbox" name="billable" value="1" data-bind="checked: userProfile().billable, disable:isBillable();">
        </div>
      </div>
    </div
<?php else: ?>
      <div class="field">
        <label><?=l(273)?></label>
        <div class="input">
     <!-- This is where the else would go -->     
                <input type="checkbox" name="billable" value="1" data-bind="checked: userProfile().billable, enable:isBillable();">
        </div>
      </div>
    </div>
<?php endif; ?>

probably, you would need to enable those syntax in your php.ini as well

short_open_tag=On

Until we get those error logs, we won't know if this really does solve your problem, but at least we can pair the code down quite a bit by using a ternary and only outputting the changed section.

<? $data-bind = $perms['user_profiles|edit_billable'] ? "checked: userProfile().billable, enable:isBillable();" : "checked: userProfile().billable, disable:isBillable();" ?> 
<div class="field">
    <label><?=l(273)?></label>
    <div class="input">
        <input type="checkbox" name="billable" value="1" data-bind="<?=$data-bind?>">
    </div>
</div>

Also I'll mention that using short tags, like <? aren't recommended if you intend this code to be portable and used by other people, since support for those tags can be turned off. Instead format like this:

<?php $data-bind = $perms['user_profiles|edit_billable'] ? "checked: userProfile().billable, enable:isBillable();" : "checked: userProfile().billable, disable:isBillable();" ?> 
<div class="field">
    <label><?php echo l(273)?></label>
    <div class="input">
        <input type="checkbox" name="billable" value="1" data-bind="<?php echo $data-bind?>">
    </div>
</div>

While more verbose, is executable by a greater number of people.

Your if and else works properly, but

<?=l(273)?>

Not working. If "l" is custom function, use

<? l(273);?>

instead and it will work.

Try this, may be it will solve the problem.

<?php

// true
if ($perms['user_profiles|edit_billable']===TRUE) {  

?>
<div class="field">
    <label><?php=l(273)?></label>
    <div class="input">
           <input type="checkbox" name="billable" value="1" data-bind="checked: userProfile().billable, disable:isBillable();">

    </div>
  </div>
</div>


<?php


}elseif ($perms['user_profiles|edit_billable']===FALSE){
// false
    ?>

<div class="field">
    <label><?php=l(273)?></label>
    <div class="input">
 <!-- This is where the else would go -->     
            <input type="checkbox" name="billable" value="1" data-bind="checked: userProfile().billable, enable:isBillable();">

    </div>
  </div>
</div>



<?php 
 }
 ?>