mercredi 11 mai 2016

How do I delete every object that is checked

Im kind of stuck. I want to be able to delete every user that is checked in the checkboxes.

This is my table/form right now anvandare.php:

   <?php

                        $query = "select * from user order by date DESC";

                        $run = $mysqli->query($query);

                  while($row=mysqli_fetch_array($run)){ //Hämtar informationen från användaren 

                        $userID = $row['userID'];
                        $email = $row['email'];
                        $company = $row['company'];
                        $fname = $row['fname'];
                        $tel = $row['tel'];
                        $test_status = $row['test_status'];
                        $date = $row['date'];

                  ?>
               <td><?php echo $userID; ?></td>
               <td><?php echo $email; ?></td>
               <td><?php echo $company; ?></td>
               <td><?php echo $fname; ?></td>
               <td><?php echo zero($tel); ?></td>
               <td><?php echo $date; ?></td>
               <td><?php echo $test_status; ?></td>
               <form action="delete.php" method="POST">
               <td><input type="checkbox" name="<?php echo $userID;?>" value="checked"></td>
            </tr>
            <?php } ?>
            <tr><td><input type="submit" value="Skicka"></form></td></tr>
         </table>

This is my delete.php right now..:

<?php
mysql_connect("localhost","root", "");
mysql_select_db("Webbprojekt");

if(isset($_POST))
{
    var_dump($_POST);
}
?>

Do you have any successions of how to continue?

Aucun commentaire:

Enregistrer un commentaire