mardi 19 novembre 2019

How can I check if all checkboxes have been checked in PHP?

I am implementing a list of items and each has a checkbox. I currently can see which checkboxes have been checked but what I want to do is check if all of them have been checked. How can I implement that?

Here is my code:

 <?php
            echo "<table>
                <tr>
                <th>Customer ID</th>
                <th>Report ID</th>
                <th>Report message</th>
                <th>Device</th>
                <th>Device no.</th>
                <th>Barcode</th>
                <th>IMEI</th>
                <th>Sale-date</th>
                </tr>";

            while ($row2 = $clientUsername->fetch_assoc()) {

                $_SESSION['cl_username'] = $row2["username"];
                while ($row = $message->fetch_assoc()) {

                    $_SESSION['accept'] = $row["acceptance"];
                    $_SESSION['client_comment'] = $row["message"];
                    $_SESSION['name'] = $row["name"];
                    $_SESSION['sales_date'] = $row["sales_date"];
                    $_SESSION['date_sent'] = $row["date_sent"];


                    $_SESSION['countable_array']  = $row;

                    ?>

            <?php if ($row['acceptance'] == 3) {

                        echo "<tr> <td>
                              " . '<input type=checkbox name=devices[] value=' . $row['dev_id'] . '>' . "
                        </td> <td>" . $cus_id . " </td> <td>" . $rep_id . "</td> <td>" . $_SESSION['client_comment'] . "</td> <td>" . $_SESSION['name'] . "</td> <td>" . $row["device_no"] . "</td> <td>" . $row["barcode"] . "</td> <td>" . $row["serial_imei"] . "</td> <td>" . $row["serial_no"] . "</td> <td>" . $row["sales_date"] . "</td></tr>";
                        echo "</table>";
                    }
                }
            }



Aucun commentaire:

Enregistrer un commentaire