I created a table in twig template. In the first Column you can check a checkbox. After checking checkbox it should remove the row. My problem is how I can get the Data to remove it.
Here is my table
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th> <label for="checbox">Check</label></th>
<th>id</th>
<th>Name</th>
<th>Age</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
if(isset($_POST['checkBox'])== 'true'){
$products = $_POST['??????'];
$zl = 0;
foreach ($products as $pr)
{
$em = $this->getDoctrine ()->getManager ();
$pr = $em->getRepository('UserBundle:Products')->find($pr);
$user->removeProduct($pr);
++$zl;
}
$em->persist($user);
$em->flush();
}
How I can get the Data? $products = $_POST['??????']; I don"t know which parameter I have to put here to get the Data from the selected checkbox.
Aucun commentaire:
Enregistrer un commentaire