samedi 21 décembre 2019

Im running intp a problem with my checkbox list in php, where the code is executed in php but not in my database?

Im trying to delete data from my dayabase , now i use the following code in my php as you can see below:

if(isset($_POST['label-delete-btn'])){

include 'conn.php';

$checkbox=$_POST['num'];

    while (list($key,$val)=@each($checkbox)) {
        $query="SELECT * FROM posts WHERE id='$val' ";
        if($result=mysqli_query($conn,$query)){
            echo 'selected data is deleted';
        }
    }

and my input element inside the form is as the following :

<input type="checkbox" name="num[]" value="<?php echo $post['id'];?>">

Now by submitting the button , the code exetues by itself, but ,y databse remains without changes




Aucun commentaire:

Enregistrer un commentaire