使用复选框将数据放入我的数据库

I am making a project where user can create a schedule and post it, so I am using a check box for the days and a date beside them, I found this code online and I'm having trouble understanding it's process maybe if I know how it works I can create my own..

<?php
            include('../dist/includes/dbcon.php');
            $query=mysqli_query($con,"select * from time where days='mwf' order by time_start")or die(mysqli_error());

            while($row=mysqli_fetch_array($query)){
                    $id=$row['time_id'];
                    $start=date("h:i a",strtotime($row['time_start']));
                    $end=date("h:i a",strtotime($row['time_end']));
    ?>
                          <tr >
                            <td><?php echo $start."-".$end;?></td>
                            <td><input type="checkbox" id="check" name="m[]" value="<?php echo $id;?>" style="width: 20px; height: 20px;"></td>
                            <td><input type="checkbox" id="check" name="w[]" value="<?php echo $id;?>" style="width: 20px; height: 20px;"></td>
                            <td><input type="checkbox" id="check" name="f[]" value="<?php echo $id;?>" style="width: 20px; height: 20px;"></td>

                          </tr>

    <?php }?>                     
    </table> 

I know how he get's data from the database, the question is how did he input the data into the database. the database called schedule has these fields (time_id, days, subject) so it is understandable that when a user check m then the data would be input in the days but how did he input the time_id? the time database contains these fields (time_id,time_start, time_end) so basically if the user chose 7:00-8:00 that has the time_id of one, then choose W, the schedule database would look like these sched_id =1, time_id = 1, days = w..but how should I write that? thanks in advance