first commit
This commit is contained in:
32
cms_admin/contact_delete.php
Normal file
32
cms_admin/contact_delete.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
// Include the database connection file
|
||||
include('container/security.php');
|
||||
|
||||
if (isset($_GET['id'])) {
|
||||
// Retrieve category ID from the URL
|
||||
$id = intval($_GET['id']);
|
||||
|
||||
// Check if the ID is valid
|
||||
if ($id > 0) {
|
||||
|
||||
// Prepare the SQL DELETE statements
|
||||
$delete_category_sql = "DELETE FROM contacts WHERE id = $id";
|
||||
|
||||
// Execute the SQL statements
|
||||
if (mysqli_query($conn, $delete_category_sql)) {
|
||||
echo "<script>alert('Contat data deleted successfully.'); window.location.href = 'contact-form';</script>";
|
||||
} else {
|
||||
echo "<script>alert('Error: " . mysqli_error($conn) . "'); window.location.href = 'contact-form';</script>";
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "<script>alert('Invalid category ID.'); window.location.href = 'contact-form';</script>";
|
||||
}
|
||||
} else {
|
||||
echo "<script>alert('No category ID provided.'); window.location.href = 'contact-form';</script>";
|
||||
}
|
||||
|
||||
// Close the database connection
|
||||
mysqli_close($conn);
|
||||
?>
|
||||
Reference in New Issue
Block a user