Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 两个表以不同的方式使用相同的样式表对齐_Php_Html_Css_Forms_Html Table - Fatal编程技术网

Php 两个表以不同的方式使用相同的样式表对齐

Php 两个表以不同的方式使用相同的样式表对齐,php,html,css,forms,html-table,Php,Html,Css,Forms,Html Table,我有两张桌子。一个是用html(和一点php)创建的,而另一个是由两个php循环创建的 首先,样式表: .statistics { font-family: Arial, monospace; font-size: 36px; margin-left: 5%; width: 90%; } .statistics tr { line-height: 50px; } .statistics th { text-align: center; } .

我有两张桌子。一个是用html(和一点php)创建的,而另一个是由两个php循环创建的

首先,样式表:

.statistics {
    font-family: Arial, monospace;
    font-size: 36px;
    margin-left: 5%;
    width: 90%;
}

.statistics tr {
    line-height: 50px;
}

.statistics th {
    text-align: center;
}

.statistics td {
    text-align: center;
}

button {
    margin-left: 25%;
    width: 50%;
    height: 40px;
    border: none;
    border-radius: 20px;
    font-family: Arial, monospace;
    font-size: 20px;
}
下表正确对齐:

<table class="statistics">
        <tr>
            <th>Benutzer</th>
            <th>Artikel</th>
            <th>Reservierungen</th>
        </tr>
        <tr>
            <td><?php echo $client->statistic_getAmount();?></td>
            <td><?php echo $articles->statistic_getAmount();?></td>
            <td><?php echo $reservations->statistic_getAmount();?></td>
        </tr>
        <tr>
            <th>Seiten (.php)</th>
            <th>Datenbankeinträge</th>
            <th>Zeilen mit Code</th>
        </tr>
        <tr>
            <td>18</td>
            <td>27</td>
            <td>4407+</td>
        </tr>
    </table>
<form method="post" action="webinterface.php" class="perms">
        <table class="statistics">
            <tr>
                <th>Benutzer</th>
                <?php
                foreach ($permgroupa as $group) {
                    echo "<th>".$group."<th>";
                }
            echo "</tr>";
            $users = $client->getUsers();

            while ($row = mysqli_fetch_assoc($users)) :?>
                <tr>
                    <td><?php echo $row['username'];?></td>
                    <?php foreach ($permgroupa as $group) : ?>
                        <td><input type="checkbox" name="<?php echo $group;?>-<?php echo $row['username'];?>" <?php if ($perms->hasPermission($row['username'], $group)) {echo "checked";}?>></td>
                    <?php endforeach;?>
                </tr>
            <?php endwhile;?>
    </table><button type="submit" class="btnalter" name="alterrights">Rechte aktualisieren</button></form>

贝努策
冠词
储备根
Seiten(.php)
Datenbankeinträge
泽伦麻省理工学院代码
18
27
4407+
虽然这一个没有正确对齐:

<table class="statistics">
        <tr>
            <th>Benutzer</th>
            <th>Artikel</th>
            <th>Reservierungen</th>
        </tr>
        <tr>
            <td><?php echo $client->statistic_getAmount();?></td>
            <td><?php echo $articles->statistic_getAmount();?></td>
            <td><?php echo $reservations->statistic_getAmount();?></td>
        </tr>
        <tr>
            <th>Seiten (.php)</th>
            <th>Datenbankeinträge</th>
            <th>Zeilen mit Code</th>
        </tr>
        <tr>
            <td>18</td>
            <td>27</td>
            <td>4407+</td>
        </tr>
    </table>
<form method="post" action="webinterface.php" class="perms">
        <table class="statistics">
            <tr>
                <th>Benutzer</th>
                <?php
                foreach ($permgroupa as $group) {
                    echo "<th>".$group."<th>";
                }
            echo "</tr>";
            $users = $client->getUsers();

            while ($row = mysqli_fetch_assoc($users)) :?>
                <tr>
                    <td><?php echo $row['username'];?></td>
                    <?php foreach ($permgroupa as $group) : ?>
                        <td><input type="checkbox" name="<?php echo $group;?>-<?php echo $row['username'];?>" <?php if ($perms->hasPermission($row['username'], $group)) {echo "checked";}?>></td>
                    <?php endforeach;?>
                </tr>
            <?php endwhile;?>
    </table><button type="submit" class="btnalter" name="alterrights">Rechte aktualisieren</button></form>

贝努策

1-不要把你的桌子放在表格里


2-第一个表和第二个表的列数不一样

1-否则我应该如何在网格方案中设置复选框?2-第二个表中的两个foreach循环都创建了2列。