searching the web I can not find the solution, so I ask for help, I need to validate a checkbox group that is generated for each row of a table, what I need is that you can select a check only if the row previous one was selected first, that is to say for example that of an error if I want to select the check in row 3, without first selecting the one in row 2, this is the table where the check is generated:
<table class="table table-striped table-bordered table-hover dataTable">
<thead>
<tr> <!-- encabezado de tabla -->
<td colspan="4" bgcolor="#58acfa">
<p style="color:#ffffff";><strong>TODAS LAS CUOTAS</strong></p>
</td>
</tr>
<tr>
<th><center>Cuotas</center></th>
<th><center>Importe</center></th>
<th><center>Fecha de Vencimiento</center></th>
<th style="width: 20%;"><center>PAGAR</center></th>
</tr>
</thead>
<tbody>
<?php
if (count($cuentas) > 0) {
if (is_array($cuentas)) {
foreach ($cuentas as $cuenta):
?>
<tr>
<td style="font-family: 'Open Sans', sans-serif;"><center><?php echo element('cuotas', $cuenta); ?></center></td>
<td style="font-family: 'Open Sans', sans-serif;"><center><?php echo element('importe', $cuenta); ?></center></td>
<?php $fechaVencimiento = element('fechaVencimiento', $cuenta); ?>
<td style="font-family: 'Open Sans', sans-serif;"><center><?php echo $fechaVencimiento;?></center></td>
<td>
<center>
<input type="checkbox">
</center>
</td>
</tr>
<?php
endforeach;
}
}
?>
</tbody>
</table>