Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

152
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda