I am trying to fetch elements which are checked so that I can delete them from database .
I used 'get' method so that I could see elements those I am selecting .
[]21 food
[]22 eggs
[]23 bread
[]24 bread
this is my data in database if I am selecting food it is showing
http://localhost/shopping/delete.php?21=&delete= (in url)
it should be 21='on', but it is not showing why and please tell me how to fetch them to delete if I cannot do like this .
<?php require_once("dbconnect.php") ?>
<?php
db();
global $link;
$query="SELECT * FROM items";
$result=mysqli_query($link,$query);
?>
<form action="delete.php" method="get">
<?php
while ($arr=mysqli_fetch_array($result)) {
?>
<ul>
<li> <input type="checkbox" name="<?php echo $arr['id'] ?>" value=""> <?php echo $arr['id'] ?> <?php echo $arr['itemname'] ?> </li>
</ul>
<?php
}
?>
<button type="submit" name="delete">delete</button>
</form>
Aucun commentaire:
Enregistrer un commentaire