Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

148
Visualizações
How can I toggle Bootstrap checkbox in PHP Foreach Statement using jQuery and Pass it the data as an Ajax Request to the endpoint

Find blow the source code please, How can I toggle Bootstrap checkbox in PHP For each Statement using jQuery and Pass it the data as an Ajax Request to the endpoint. When I checked any checkbox it will toggle me the value of that particular I toggle.

 <?php

    if(isset($_GET['page']))
    {
    $page=$_GET['page'];
    }
    else
    {
    $page = 1;
    }
    
    $limit = 25;
    
    $offset=($page-1)*$limit;
    
    $select_stmt=$con->prepare("SELECT * FROM plan ORDER BY id DESC LIMIT ?,? ");
    $select_stmt->bindValue(1, $offset, PDO::PARAM_INT);    
    $select_stmt->bindValue(2, $limit, PDO::PARAM_INT); 
    $select_stmt->execute();
    $rows=$select_stmt->fetchAll(PDO::FETCH_ASSOC);
    
    foreach ($rows as $row) {
?>
    <tr>
      <td><?php echo $row['title']; ?></td>
      <td>
        <?php

          $query = "SELECT * FROM networks WHERE network_id=:myplan_id";
          $statement = $con->prepare($query);
          $statement->execute([
            ':myplan_id' => $row['network_id']
          ]);
          $title = $statement->fetch(PDO::FETCH_ASSOC);

          echo $title['title'];

        ?>
      </td>
      <td>
          <?php
            $money = Money::of($row['amount'], 'NGN');
            echo $money->formatTo('en_US');
          ?>
      </td>
      <td>
        <?php
            if ($row['status'] == NULL || $row['status'] == 'active') {
        ?>
          <span class="badge bg-success">Active</span>
        <?php
            }else{
        ?>
          <span class="badge bg-danger">In Active</span>
        <?php
            }
        ?>
      </td>
      <td><?php echo $row['created_at']; ?></td>
      <td>
        <div class="form-check form-switch">
          <input class="form-check-input" type="checkbox" role="switch" id="checkbox<?= $row['id']?>">
        </div>enter code here
      </td>
      <td><a href="edit_plan.php?id=<?php echo $row['id']?>" class="btn btn-success"><i class="fa fa-edit"></i> </a></td>
    </tr>
<?php
    }
          ?>
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda