-
Notifications
You must be signed in to change notification settings - Fork 1
/
delete.php
163 lines (146 loc) · 6.16 KB
/
delete.php
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
// Process delete operation after confirmation
if(isset($_POST["id"]) && !empty($_POST["id"])){
// Include config file
require_once "config.php";
// Prepare a delete statement
$sql = "DELETE FROM todolist WHERE id = ?";
if($stmt = mysqli_prepare($link, $sql)){
// Bind variables to the prepared statement as parameters
mysqli_stmt_bind_param($stmt, "i", $param_id);
// Set parameters
$param_id = trim($_POST["id"]);
// Attempt to execute the prepared statement
if(mysqli_stmt_execute($stmt)){
// Records deleted successfully. Redirect to landing page
header("location: todolist.php");
exit();
} else{
echo "Oops! Something went wrong. Please try again later.";
}
}
// Close statement
mysqli_stmt_close($stmt);
// Close connection
mysqli_close($link);
} else{
// Check existence of id parameter
if(empty(trim($_GET["id"]))){
// URL doesn't contain id parameter. Redirect to error page
header("location: error.php");
exit();
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>
Delete Task
</title>
<link href="https://fonts.googleapis.com/css?family=Satisfy" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="css/common.css">
<style>
body{
/*background:url("https://cdn.hipwallpaper.com/i/83/15/VBLWMS.jpg");https://wallpapercave.com/wp/wp4659368.jpg ; https://wallpapercave.com/wp/wp4659368.jpg ;
background-repeat: no-repeat;*/
background-size: cover;
margin:0;
}
body>div{
padding:1%;
}
.wrapper{
width: 650px;
margin: 0 auto;
}
.page-header h1{
margin-top: 0;
padding:10px;
background: beige;
box-shadow: 0px 0px 9px 0px rgba(0,0,0,0.1);
}
.alert{
background:pink;
padding:10px;
box-shadow: 0px 0px 9px 0px rgba(0,0,0,0.1);
}
.btn {
border: none;
background:black;
color:white;
outline: 0;
display: inline-block;
padding: 4px;
text-align: center;
cursor: pointer;
width: 48.5%;
height:10%;
}
a{
text-decoration:none;
}
.btn:hover {
background-color: #555;
}
</style>
</head>
<body>
<header>
<div class="header" style="color:white;">
<img src="images/logo.png" width=35px height=30px>
<h1 style="display: inline; ">FITNESS 101</h1>
<div class="dropdown">
<button class="dropbtn"><img src="images/user.png" width=40px height=40px ></button>
<div class="dropdown-content">
<a href="help.php">Report Problem</a>
<a href="contactus.html">Contact Us</a>
<a href="member.php">Dashboard</a>
<a href="logout.php">Log out</a>
</div>
</div>
</div>
</header>
<nav>
<div id="navigation">
<a href="homepage.html">Home</a>
<a href="health.html">Healthy Living</a>
<a href="faq.html">FAQ</a>
<a href="contactus.html">Contact Us</a>
<a href="help.php">Help</a>
<a href="member.php">Member's Area</a>
</div>
</nav>
<div class="wrapper">
<div class="page-header">
<h1>Delete Task</h1>
</div>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
<div >
<input type="hidden" name="id" value="<?php echo trim($_GET["id"]); ?>"/>
<p class="alert">Have you completed this task? <br> Are you sure you want to delete it?</p>
<br>
<input type="submit" value="Yes" class="btn">
<a href="todolist.php" class="btn " style="font-size:11px;">No</a>
</div>
</form>
</div>
<footer style="margin-top:4%;">
<div class="footer">
FOLLOW US
<div id="social-media">
<a href="https://www.instagram.com/rajshree.varma/saved/?hl=en"><img src="https://www.iconfinder.com/data/icons/2018-social-media-black-and-white-logos/1000/2018_social_media_popular_app_logo_facebook-256.png" alt="visit our facebook" class="social"></a>
<a href="https://www.instagram.com/rajshree.varma/saved/?hl=en"><img src="https://www.iconfinder.com/data/icons/2018-social-media-black-and-white-logos/1000/2018_social_media_popular_app_logo_instagram-256.png" alt="visit our instagram " class="social"></a>
<a href="https://www.instagram.com/rajshree.varma/saved/?hl=en"><img src="https://www.iconfinder.com/data/icons/2018-social-media-black-and-white-logos/1000/2018_social_media_popular_app_logo_twitter-256.png" alt="visit our twitter " class="social"></a>
</div>
<!-- Copyright -->
<div class="footer-copyright" style=" background-color:rgba(255, 255, 255, 0.13);">
© 2020 Copyright:
<a href="homepage.html" style="text-decoration:none; color:rgba(255, 255, 255, 0.281);"> Fitness101.com</a>
All rights reserved.<br>
</div>
<!-- Copyright -->
</div>
</footer>
</body>
</html>