0
I have a table where one of your columns is a checkbox, I need to do when the checkbox are selected click on a "Delete Selected" button where it is possible to recover for me all the values of the selected Checkbox.
This HTML table comes from an Ajax request, where it is mounted in HTML, so it is dynamic.
while ($linha = $result->fetch_assoc())
{
$codigo= utf8_encode($linha["codigo"])." "
$return.= "<td>". "<input type=\"checkbox\" name=\"cb\" value=\"".$codigo."\" > "."</td>";
$return.= "<td>" . utf8_encode($linha["data"]) . "</td>";
$return.= "<td>" . utf8_encode($linha["hora"]) . "</td>";
$return.= "<td>" . utf8_encode($linha["origem"]) . "</td>";
$return.= "<td>" . utf8_encode($linha["destino"]) . "</td>";
}
How can I do this? Should I put my table inside a form and send the form to another page? I actually tried to do this, so I put this table in a form, and clicking the button sends the data to a Delete.php page
I tried using the following command to recover the value foreach ($_POST as $key => $value) { echo $key;// Here was to appear the value of the code, but appears only the name of a button, getting "cb" }
So, how do I retrieve the code? Is there a more correct way to do this? I would also like to know if it is possible to send all the values selected via Ajax to the server, how to resolve this issue?
That was my question, thank you very much for your reply. but with respect to loop repeating to get the value of all my checkbox, as it is possible to do?
– Bruno Aparecido da Silva
gives up the answer, you can use the function each of jquery example:
$('.classe').each(function(indice, obj) {
 
});
– 13dev
I’ll give up, but I keep facing problems, I did an if to know if I was getting the value in php page but I’m not, how is it possible to see the values of the serialized data? it is possible to send only the checkbox field ?
– Bruno Aparecido da Silva
It was my mistake, I was able to identify the problem. Thank you for the solution
– Bruno Aparecido da Silva