-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete.php
133 lines (110 loc) · 2.71 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
<?php
require 'config.php';
session_start();
if(!isset($_SESSION['sess_user_id'])){
header('Location: login.php');
}
$id = $_SESSION['sess_user_id'];
$selectedYear=$_SESSION['selectedYear'];
$prefix = 'year_';
$tableName = $prefix . $_SESSION['selectedYear'];
$role = $_SESSION['sess_user_role'];
$email = $_SESSION['sess_user_email'];
$result2 = mysqli_query($conn, "select * from $tableName where id = '$id' and Role = '$role' ");
$row2 = mysqli_fetch_array($result2);// row gets stored as an array
if(isset($_POST["Yes"]))
{
$query = "delete from $tableName where id = '$id' and Role = '$role'";
$result = mysqli_query($conn, $query);
if($result)
{
echo '<script type="text/javascript">alert("Deleted Succesfully!")</script>';
echo '<script language="javascript">window.location = "http://localhost/miniproject_dbms/logout.php";</script>';
}
else
{
echo '<script type="text/javascript">alert("Error!")</script>';
}
}
if(isset($_POST["No"]))
{
echo '<script language="javascript">window.location = "http://localhost/miniproject_dbms/current_hiring.php";</script>';
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Delete</title>
<style>
body {
background-color: #f2f2f2;
font-family: Arial, sans-serif;
background-image: linear-gradient(to right, #8360c3, #2ebf91);
}
h1 {
text-align: center;
font-size: 25px;
margin-bottom: 20px;
color: #333;
text-transform: uppercase;
letter-spacing: 3px;
font-weight: 900;
}
.container {
margin: 50px auto;
max-width: 600px;
padding: 20px;
background-color: #FAF0E6;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
border-radius: 5px;
background-color: rgba(255, 255, 255, 0.5);
}
p.top {
font-size: 20px;
margin-top: 20px;
margin-bottom: 20px;
text-align: center;
}
form {
text-align: center;
}
input.button {
display: inline-block;
padding: 10px 20px;
margin: 10px;
font-size: 20px;
font-weight: bold;
color: #ffffff;
background-color: #333;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}
input.button:hover {
background-color: #cc0000;
}
a {
display: block;
margin-top: 20px;
font-size: 20px;
text-align: center;
color: #333333;
}
a:hover {
color: #cc0000;
}
</style>
</head>
<body>
<h1>Cancel The Current Recruitment Process?</h1>
<div class="container">
<p class="top">Are you sure you want to cancel it?</p>
<form method="post">
<input type="submit" name="Yes" class="button" value="Yes, Delete The Data For This Job Role!" />
<input type="submit" name="No" class="button" value="No, Take me Back!" />
</form>
<a href="current_hiring.php">Back</a>
</div>
</body>
</html>