-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete.php
More file actions
23 lines (22 loc) · 746 Bytes
/
delete.php
File metadata and controls
23 lines (22 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
$item_name = $_POST['item_name'];
$category = $_POST['category'];
$conn = mysqli_connect('localhost','root','','donationsystem');
if($conn){
if(isset($item_name) && isset($category))
{
$stmt = $conn->prepare("delete from items where item_name = ? and category = ?");
$stmt->bind_param("ss",$item_name,$category);
$stmt->execute();
$result = $stmt->get_result();
echo "<script>alert('Item Deleted successfully')</script>";
echo "<script>window.location='./#items-display'</script>";
}
else{
echo "Deletion unsuccessfull! Please try again";
}
}
else{
echo "Connection Failed";
}
?>