Checkbox inside While

1

I need to replicate this table from the company's ERP system to the WEB system.

ButusingthecodebelowtheimageIhavethevalueofthevariablesthatare0and1.

<tableborder="2">
          <tr>
              <th>  Id  </th>
              <th> Tipo </th>
              <th> Descrição </th>
              <th> NFe </th>
              <th> Bonificada </th>
              <th> Quebra </th>
              <th> Falha na Operação </th>
              <th> Transferência </th>
              <th> Movimenta Estoque </th>
              <th> Valida Preço </th>
              <th> Gera Entrada </th>
          </tr>
      <?php
            include ("conn.php");

              $result = "SELECT * FROM tipofat ORDER BY id";
              $resultado = mysqli_query($conn, $result);


              while ($row = mysqli_fetch_assoc($resultado)){

                  echo "<tr class='btn-default'>";
                      echo "<td class='get-func'>". $row['id'] ."</td>";
                      echo "<td class= 'get-cadfunc'>". $row['tp_faturamento'] ."</td>";
                      echo "<td class= 'get-cadfunc'>". $row['descricao'] ."</td>";
                      echo "<td class= 'get-cadfunc'>". $row['nfe'] ."</td>"; 
                      echo "<td class= 'get-cadfunc'>". $row['bnf_com_nota'] ."</td>";
                      echo "<td class= 'get-cadfunc'>". $row['bnf_sem_nota'] ."</td>";
                      echo "<td class= 'get-cadfunc'>". $row['falha_operacao'] ."</td>";
                      echo "<td class= 'get-cadfunc'>". $row['transferencia'] ."</td>";
                      echo "<td class= 'get-cadfunc'>". $row['mov_estoque'] ."</td>";
                      echo "<td class= 'get-cadfunc'>". $row['valida_preco'] ."</td>";
                      echo "<td class= 'get-cadfunc'>". $row['gera_entrada'] ."</td>";
                  echo "</tr>";
              }
          ?>
  </table>

I've tried a thousand ways to make checkbox values instead of checkox by changing my <td></td> , but without success because the checkboxes are inserted in the places of the numbers but not filled / checked, I'll leave an example below the attempts

echo '<td><input type="checkbox" name="nfe['.$row['nfe'].']" value="'. $row['nfe'] .' onclick="return false;" "</td>';
echo '<td><input type="checkbox" '. $row['nfe'] .' onclick="return false;" "</td>';
    
asked by anonymous 26.10.2017 / 19:26

1 answer

2
<table border="2">
          <tr>
              <th>  Id  </th>
              <th> Tipo </th>
              <th> Descrição </th>
              <th> NFe </th>
              <th> Bonificada </th>
              <th> Quebra </th>
              <th> Falha na Operação </th>
              <th> Transferência </th>
              <th> Movimenta Estoque </th>
              <th> Valida Preço </th>
              <th> Gera Entrada </th>
          </tr>
      <?php
            include ("conn.php");

              $result = "SELECT * FROM tipofat ORDER BY id";
              $resultado = mysqli_query($conn, $result);


              while ($row = mysqli_fetch_assoc($resultado)){

                  echo "<tr class='btn-default'>";
                      echo "<td class='get-func'>". $row['id'] ."</td>";
                      echo "<td class= 'get-cadfunc'>". $row['tp_faturamento'] ."</td>";
                      echo "<td class= 'get-cadfunc'>". $row['descricao'] ."</td>";
                      echo "<td class= 'get-cadfunc'><input type=\"checkbox\"". (($row['nfe'] == 1) ? " checked" : "")." disabled></td>"; 
                      echo "<td class= 'get-cadfunc'><input type=\"checkbox\"". (($row['bnf_com_nota'] == 1) ? " checked" : "")." disabled></td>";
                      echo "<td class= 'get-cadfunc'><input type=\"checkbox\"". (($row['bnf_sem_nota'] == 1) ? " checked" : "")." disabled></td>";
                      echo "<td class= 'get-cadfunc'><input type=\"checkbox\"". (($row['falha_operacao'] == 1) ? " checked" : "")." disabled></td>";
                      echo "<td class= 'get-cadfunc'><input type=\"checkbox\"". (($row['transferencia'] == 1) ? " checked" : "")." disabled></td>";
                      echo "<td class= 'get-cadfunc'><input type=\"checkbox\"". (($row['mov_estoque'] == 1) ? " checked" : "")." disabled></td>";
                      echo "<td class= 'get-cadfunc'><input type=\"checkbox\"". (($row['valida_preco'] == 1) ? " checked" : "")." disabled></td>";
                      echo "<td class= 'get-cadfunc'><input type=\"checkbox\"". (($row['gera_entrada'] == 1) ? " checked" : "")." disabled></td>";
                  echo "</tr>";
              }
          ?>
  </table>
    
26.10.2017 / 19:42