使用PHP的多个单选按钮值

使用PHP的多个单选按钮值,php,mysqli,Php,Mysqli,我是新的PHP,我会谷歌几个网站,但无法找到任何解决方案,我明白,所以我的问题是相当复杂的,因为我认为我有愚蠢的问题的答案将高度赞赏 我有HTML代码 <table class="table table-bordered table-hover"> <thead> <tr> <td>Sr.</td> <td>Name<

我是新的PHP,我会谷歌几个网站,但无法找到任何解决方案,我明白,所以我的问题是相当复杂的,因为我认为我有愚蠢的问题的答案将高度赞赏

我有HTML代码

<table class="table table-bordered table-hover">
        <thead>
            <tr>
                <td>Sr.</td>
                <td>Name</td>
                <td>Father Name</td>
                <td>Roll No.</td>
                <td>Gender</td>
                <td>Attendance</td>
            </tr>
        </thead>    
        <tbody>
            <?php $q=mysqli_query($dbc,"SELECT * FROM students");
                while ($r=mysqli_fetch_assoc($q)):
        ?>
            <tr>
                <td><?=$r['students_id']?></td>
                <td><?=$r['students_name']?></td>
                <td><?=$r['fname']?></td>
                <td><?=$r['students_reg']?></td>
                <td><?=$r['gender']?></td>
                <td>
                    <div class="radio">
                        <label>
                        <input type="radio" name="attendance[++i]" value="Present">
                                Present     
                        </label>
                        <label for="">
                        <input type="radio" name="attendance[++j]" value=Absent>
                                Absent
                        </label>
                    </div>
                </td>
            </tr>
        </tbody>
        <?php endwhile ?>
    </table>    
    <button class="btn btn-success form-control"  name="add_attendance">Register</button>

老。
名称
父名
卷号。
性别
出勤
目前
缺席的
登记

所有值都是从数据库中提取的,该数据库是从另一个页面插入的,但最后一个页面显示单选按钮除外。我的问题是,我将无法选择一个以上的单选按钮,即一列中存在,另一列中不存在。我想为从数据库提取的每个字段选择一个按钮,并在提交表单时存储单选按钮值与提取的记录值平行??我希望你能理解我的问题:(

那么到底是什么不起作用呢?我可以看到你在一个计数器上使用的是
考勤[++i]
,而另一个计数器是不同的-
考勤[++j]
为什么不使用
$r['students\u id']
作为数组名称,这样就更容易获得post->
名称上的值=“Attention[]”
我的问题解决了一半,现在请告诉我如何将这些单选按钮存储到动态创建的数据库中,现在我可以在每行上选择多个单选按钮,但现在我如何使用与这些id平行的一次单击插入sql db