Php 如果表单有1个或多个错误,则表单复选框值保留

Php 如果表单有1个或多个错误,则表单复选框值保留,php,forms,Php,Forms,$facility=$_POST[“利息] <input type="checkbox" name="interests[]" id="" value="wifi" value="<?php echo in_array('wifi', $facility)??>checked='checked'<?php:;?>" /><label class="check_label">Wifi</label> <input type="che

$facility=$_POST[“利息]

<input type="checkbox" name="interests[]" id="" value="wifi" value="<?php echo in_array('wifi', $facility)??>checked='checked'<?php:;?>" /><label class="check_label">Wifi</label>
<input type="checkbox" name="interests[]" id="" value="spa"  value="<?php echo in_array('spa', $facility)?>checked='checked'<?php:;?>"/><label class="check_label">Spa</label>

<input type="checkbox" name="interests[]" id="" value="pet allowed" value="<?php echo in_array('pet allowed', $facility)?>checked='checked'<?php:;?>"/><label class="check_label">Pet Allowed</label>
<代码>最后我修复了bug
很抱歉,我在解决此问题时遇到了挫折,但在原始脚本中它是正确的。您应该指定问题所在
<input type="checkbox" name="interests[]" id="" value="wifi" value="<?php  in_array('wifi', $facility){?>checked='checked'<?php}?>" /><label class="check_label">Wifi</label>
<input type="checkbox" name="interests[]" id="" value="spa"  value="<?php  in_array('spa', $facility){?>checked='checked'<?php}?>"/><label class="check_label">Spa</label>
<input type="checkbox" name="interests[]" id="" value="pet allowed" value="<?php  in_array('pet allowed', $facility){?>checked='checked'<?php}?>"/><label class="check_label">Pet Allowed</label>
 <input type="checkbox" name="interests[]" id="" value="wifi" <?php if(in_array('wifi', $facility)==TRUE){echo "value=wifi checked='checked'";}?> /><label class="check_label">Wifi</label>
                    <input type="checkbox" name="interests[]" id="" value="spa"  <?php if(in_array('wifi', $facility)==TRUE){echo "value=spa checked='checked'";}?>/><label class="check_label">Spa</label>
                    <input type="checkbox" name="interests[]" id="" value="pet allowed" <?php if(in_array('wifi', $facility)==TRUE){echo "value=pet allowed checked='checked'";}?>/><label class="check_label">Pet Allowed</label>
<?php  
  in_array('wifi', $facility){
?> checked='checked'
<?php}?>" //there is no if else exist how it check condition is true or false
<?php 
      if(in_array('wifi', $facility)==TRUE){
         echo "value=wifi checked='checked'";
      }
?>