CHECKBOX e VARIAVEIS
Tenho o seguinte formulário:
<form class="form-horizontal" method="post" action="<?= base_url('colaborador/certificado/liberaCertificado'); ?>">
<table class="table table-hover">
<thead>
<tr>
<th>MATRICULA</th>
<th>NOME</th>
<th>CPF</th>
<th>E-MAIL</th>
<th>FONE1</th>
<th>FONE2</th>
<th>STATUS</th>
<th>LIBERAR CERTIFICADO</th>
</tr>
</thead>
<tbody>
<?
foreach ($cursosDadosExt as $row):{
if ($row->STATUSLAN == 0){
$status = 'NÃO PAGO';
$certificar = "<input type='checkbox' disabled />";
}
if ($row->STATUSLAN == 1){
$status='PAGO';
if($row->resultado == 0 or $row->resultado == 'NULL'){
$certificar = "<input type='checkbox' name='certificar[]' id='certificar' value='1' />";
}
if($row->resultado == 1){
$certificar = "<input type='checkbox' name='certificar[]' id='certificar' value='1' checked disabled/>";
}
}
//if ($row->STATUSLAN == 2){$status='CANCELADO';}
if ($row->STATUSLAN == 3){
$status='ACORDO';
$certificar = '';
}
echo "
<tr class='active'>
<td>$row->matricula</td>
<td>$row->nome</td>
<td>$row->cpf</td>
<td>$row->email</td>
<td>$row->telefone</td>
<td>$row->celular</td>
<td>$status</td>
<td>$certificar</td>
</tr>
";
?>
<input type="hidden" name="matricula[]" id="matricula" value="<?=$row->matricula?>">
<input type="hidden" name="codcusto" value="<?=$row->CODCUSTO?>">
<input type="hidden" name="perletivo" value="<?=$row->Perletivo?>">
<?
}
endforeach;
?>
</tbody>
</table>
<p align="right"><button type="submit" class="btn btn-primary">LIBERAR CERTIFICADOS SELECIONADOS</button></p>
</form>
Gostaria de pegar todas as informações, uma vez que o checkbox tenha sido selecionado.
usando este código:
$certificado = $_POST['certificar'];
$matricula = $_POST['matricula'];
$codcusto = $_POST['codcusto'];
$perletivo = $_POST['perletivo'];
if(isset($certificado))
{
$count = count($certificado);
$count2 = count($matricula);
for ($i=0;$i<$count;$i++){
$vetor = array(
'matricula' => $matricula[$i],
'certificado' => $certificado[$i],
'codcusto' => $codcusto,
'perletivo' => $perletivo
);
$atualiza = $this->colaborador->liberarCertificados($vetor);
}
}
consigo trazer, entretanto a matricula quando vem, só vem a da primeira e não a do checkbox selecionado. Alguém sabe ajudar. Preciso fazer um update no campo de resultado igual a 1 quando o certificado vier 1 com sua matricula correspondente, mas a matricula está aparecendo em ordem e não de acordo com o do selecionado.
HELP, HELP!Discussão (3)
Carregando comentários...