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