如何在 TD 元素中使用 Colspan 以 PHP 和 HTML 显示从数据库中获取的大约 20 个复选框值


how to use colspan inside td element to display around 20 checkbox values fetched from database in php and html

如何使用 col span 在 TD 内水平显示从数据库获取的 20 个复选框元素。我使用 php 从数据库中获取数据。

<table>
    <tr>
        <td>Act Name</td>
        <td colspan="5"><input type='text'></td>
    </tr>
    <tr>
        <td>Industry Type</td>
        <td colspan="5">
            <?php 
                $conn=get_dbconnect();
                $sql="SELECT id,name FROM industry"; //selection query
                $rs = mysqli_query($conn, $sql);//odbc_exec($conn,$sql);
                if (mysqli_num_rows($rs) > 0) {
                    while($row = mysqli_fetch_assoc($rs)) {
                    echo "<br> <input type='checkbox'  name='industrytype' value='".$row['name']."' onclick=checkAll(); /> ".$row['name'];
                   }
                }
            ?>
        </td>
    </tr>
</table>

td内创建一个div ,使其样式display:flex,然后将flex:1;样式添加到复选框中

这是一个有效的演示