-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete.php
More file actions
90 lines (70 loc) · 1.84 KB
/
delete.php
File metadata and controls
90 lines (70 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!-- <meta http-equiv="refresh" content="1.5; url='./routine.php'"> -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Delete row</title>
<style>
form {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 20px;
}
label {
font-size: 18px;
margin-bottom: 10px;
border-radius: 5px;
}
input[type="number"] {
border: 2px solid #ccc;
border-radius: 4px;
padding: 10px;
font-size: 16px;
width: 100%;
max-width: 300px;
margin-bottom: 20px;
}
input[type="submit"] {
background-color: hsl(0, 79%, 65%);
color: white;
border: none;
padding: 10px 20px;
border-radius: 4px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s ease;
}
input[type="submit"]:hover {
background-color: hsl(0, 79%, 55%);
box-shadow: 0px 1px 5px hsl(0, 79%, 60%);
}
</style>
</head>
<body>
<form action="#" method="post">
<label for="search">Search By Id:</label><br>
<input type="number" name="search" id="search" value="0">
<a href="routine.php">
<input type="submit" value="Delete" class="btn-del">
</a>
</form>
</body>
</html>
<?php
include_once './dbconn.php';
if (isset($_POST['search'])) {
$Period = $_POST['search'];
$query = "DELETE FROM routine WHERE Period = :Period";
$stmt = $pdo->prepare($query);
$stmt->bindParam(':Period', $Period, PDO::PARAM_STR);
$stmt->execute();
include './auto_increment.php';
// redirect the user to routine.php page...
header('Location: routine.php');
exit();
} else {
}
?>