Javascript 从另一页的db中反映存储的单选切换按钮选择

Javascript 从另一页的db中反映存储的单选切换按钮选择,javascript,php,html,sql,codeigniter,Javascript,Php,Html,Sql,Codeigniter,这可能是一个奇怪的问题,但我一直试图在codeigniter中反映db中的切换按钮,但它不起作用。切换按钮在不同页面中拾取。这是在第一页上选择它的方式: <td> <label class="switch m-r-40"> <input type="checkbox" class="switch-input" id="<?php echo $rows['applicationKey']?>" data-mail="<?php ech

这可能是一个奇怪的问题,但我一直试图在codeigniter中反映db中的切换按钮,但它不起作用。切换按钮在不同页面中拾取。这是在第一页上选择它的方式:

<td>
    <label class="switch m-r-40">
    <input type="checkbox" class="switch-input" id="<?php echo $rows['applicationKey']?>" data-mail="<?php echo $rows['email']; ?>" data-confirm="<?php echo $rows['applicationId']; ?>" id="check" name="check" <?php echo $rows['status'] ? 'checked':''; ?> >
    <span class="switch-label" data-on="yes" data-off="no"></span>
    <span class="switch-handle"></span>
    </label>
  </td>
html



确保数据类型正确。 字符串真值与布尔真值不同

    <?php
       $rows['status'] = false;
    ?>
   <td>
     <label class="switch m-r-40">
     <input type="checkbox" class="switch-input" id="check" name="check" <?php echo 
     $rows['status'] ? 'checked':''; ?> disabled="true">
      <span class="switch-label" data-on="yes" data-off="no"></span>
      <span class="switch-handle"></span>
     </label>
   </td>

   <hr />

   <?php
     $rows['status'] = "false";
    ?>
    <td>
      <label class="switch m-r-40">
      <input type="checkbox" class="switch-input" id="check" name="check" <?php echo 
      $rows['status'] ? 'checked':''; ?> disabled="true">
      <span class="switch-label" data-on="yes" data-off="no"></span>
      <span class="switch-handle"></span>
      </label>
    </td>


问题不在于禁用的=“true”。我想这很好用。而且,我真的没有得到你的纠正。
$page['applications'] = $this->db->query("SELECT a.*, b.postingName, b.`postDescription`, b.`state` FROM applications AS a INNER JOIN jobposting AS b ON a.`jobPostingKey`=b.`jobPostingKey` WHERE a.applicantKey = '$user'")->result_array();
<td>
  <label class="switch m-r-40">
  <input type="checkbox" class="switch-input" id="check" name="check" <?php echo $rows['status'] ? 'checked':''; ?> disabled="true">
  <span class="switch-label" data-on="yes" data-off="no"></span>
  <span class="switch-handle"></span>
  </label>
</td>
    <?php
       $rows['status'] = false;
    ?>
   <td>
     <label class="switch m-r-40">
     <input type="checkbox" class="switch-input" id="check" name="check" <?php echo 
     $rows['status'] ? 'checked':''; ?> disabled="true">
      <span class="switch-label" data-on="yes" data-off="no"></span>
      <span class="switch-handle"></span>
     </label>
   </td>

   <hr />

   <?php
     $rows['status'] = "false";
    ?>
    <td>
      <label class="switch m-r-40">
      <input type="checkbox" class="switch-input" id="check" name="check" <?php echo 
      $rows['status'] ? 'checked':''; ?> disabled="true">
      <span class="switch-label" data-on="yes" data-off="no"></span>
      <span class="switch-handle"></span>
      </label>
    </td>