Two checkbox one for fault and one for presence, in this case it seems better a radio button
since only one option can be checked. the m1, m2 ...
values understand how the student's enrollment or code is the one of the bank. The must be done is to make that radius an array, adding brackets in name and leave either the index or the enrollment.
<?php
$alunos = array('m1' => 'joão', 'm2' => 'maria', 'm3' => 'juca', 'm4' => 'paula', 'm5' => 'fulano');
?>
<form action="gravar_falta.php" method="post">
<?php foreach ($alunos as $matricula => $nome){ ?>
<?php echo $nome; ?>
presente
<input type="radio" name="frequencia[<?php echo $matricula; ?>]" value="presente">
falta
<input type="radio" name="frequencia[<?php echo $matricula; ?>]" value="falta"><br>
<?php } ?>
<input type="submit">
</form>
These radios will be sent to php with an array in this structure:
Array
(
[frequencia] => Array
(
[m1] => presente
[m2] => falta
[m3] => falta
[m4] => presente
[m5] => falta
)
)
Finally, just make a foreach to insert in the database:
$aula = 'português';
$frequencias = $_POST['frequencia'];
foreach ($frequencias as $aluno => $frequencia){
insertFequencia($aula, $aluno, $frequencia);
}