3
How can I get the checkbox value in the code below?
It is a presence list and this code I modified to one that I use a little different and this way I do not know how to get the values of checkboxes marked to be able in each name in the table to release the date in each name.
Type I bring the table names and those that are present I mark the checkbox and, when save, the date will be written in each name that is marked.
Follows the code:
<table width="500" border="0" bordercolor="#B9B3B3" cellspacing=0 cellpadding=2 align="center">
<tbody>
<tr align="center">
<?php
$getfamilia = "SELECT * FROM $tabela";
$getfamiliaquery = $mysqli->query($getfamilia);
while($getfamilialine = mysqli_fetch_array($getfamiliaquery))
{
$fn1="Em Andamento";
$familia = $getfamilialine['nome'];
$familia_id = $getfamilialine['id'];
$fn=$getfamilialine['finalizado'];
if(strcasecmp($fn, $fn1) == 0)
{
echo "
<tr>
<td width='250' align='center'>$familia </td>
<td width='250' align='center'> <input type='checkbox' name='op'></td>
</tr>
";
}
}
echo "</table>"; /*fecha a tabela apos termino de impressão das linhas*/
print_r($mysqli->error);
if($mysqli->connect_errno)
{
echo"Falha na conexao";
}
else
{
}
?>
<br>
<input type="submit" value="SALVAR" />
</tr>
</tbody>
</table>
Kelly, tried to pass the ID value on input:
<input type='checkbox' value='$familia_id' name='op'>
– Thyago ThySofT
I had this idea but I did it because I was going to search if I could do it in the value of the checkbox I will see Aki
– Kelly Cris
I tried to pick up the id but the update line error pq the id and an array. I did this Aki but I don’t know if it’s right. <? php $name=$_POST['family']; $data=$_POST['date']; $id=$_POST['familia_id']; $table=$_SESSION['table']; if(isset($_REQUEST['op'])) { $item= $_REQUEST['op']; $sql= $mysqli->query("UPDATE $table SET D1 = '$data' WHERE id = $item"); print_r($mysqli->error); } if($mysqli->connect_errno) { echo"Connection failure"; } Else { echo"<script> Alert('Successfully Registered!')</script>"; echo "<script>redirectpage()</script>"; } ?>
– Kelly Cris
Kelly, I’ll post an answer.
– Thyago ThySofT
http://answall.com/questions/92898/deletar-apenas-checkbox-selecionados-php/92917#92917
– Edilson
I put the code answering my question.... in the table I have the columns D1 to D7 in which have to go the date of presence of who is present. I’ve been stirring but only enter the for. n enters no if. if the quantity is equal to the quantity x inserts the date in the correct column
– Kelly Cris