0
I have the following form:
I need to get the values marked with PHP, but I’m not getting it. See below:
....
$c = 1;
$visualizar = '<table class="table table-hover">';
while($peMaterias = mysqli_fetch_object($sqlMaterias)){
$visualizar .= "<tr>";
$visualizar .= "<td><i class=\"fas fa-caret-right\"></i> <span style='font-weight: bold'>Usuário ".$c."</span></td>";
$visualizar .= "<td><div class='radio-group'>
<label class='radio-label'>
<input name='Licenca[".$c."]' type='checkbox' value='1'>
<span class='inner-label' style='color: #008000; font-weight: bold'>Fuma</span>
</label>";
$visualizar .= "<td><label class='radio-label'>
<input name='Licenca[".$c."]' type='checkbox' value='1' >
<span class='inner-label' style='color: #F00; font-weight: bold'>Bebe</span>
</label>";
$visualizar .= "<td><label class='radio-label'>
<input name='Licenca[".$c."]' type='checkbox' value='1'>
<span class='inner-label' style='color: #008000; font-weight: bold'>Trabalha</span>
</label>";
$visualizar .= "<td><label class='radio-label'>
<input name='Licenca[".$c."]' type='checkbox' value='1' >
<span class='inner-label' style='color: #F00; font-weight: bold'>PcD</span>
</label>
</div></td></tr>";
$c++;
}
And I’m trying that way:
if($_POST["Submit"] == "Salvar"){
for($i = 0; $i <= count($_POST["Licenca"]); $i++)
{
echo $_POST["Licenca"][$i]."<br>";
}
}
But you’re only returning me:
1
1
I tried that way too:
for($i = 0; $i <= count($_POST["Licenca"]); $i++)
{
$verdadeira[$i] = ($_POST["Licenca"][$i] == 1)?"S":"N";
echo $verdadeira[$i]."<br>";
}
But it returns like this:
N
S
S
You’ve already debugged the code to know exactly what the array is
$_POST
? Put it in the question, please.– Woss