vendredi 22 janvier 2021

How to have only 3 checkboxes per line with dinamic checkbox number

How to have only 3 checkboxes per line with dinamic checkbox number, for example I have 21 checkboxes (read checkbox name form a database) This is my code

<div class='form-group'>
    <div class="col-lg-12">
        <?php 
            $sql = "SELECT id, posizione, nome
                    FROM user_livelli";                 
            $result = $conn->query($sql);
            if (!empty($result) && $result->num_rows > 0) {         
                // output data of each row
                while($row = $result->fetch_assoc()) {
                    $id = $row['id'];
                    $posizione = $row['posizione'];
                    $nome = $row['nome'];
                                        
                    echo "<input type='checkbox' name='nome_posiz[]'>" ." " .$nome ." ";
                }
            }
        ?>
    </div>
</div>

I have the following situation enter image description here But I would like to have only 3 checkboxes per line, for example the 3 with black dot on the first line, the 3 with the red dot on another line, the 3 with the green dot on another line and so on. Something like this done using PAINT enter image description here




Aucun commentaire:

Enregistrer un commentaire