-
Notifications
You must be signed in to change notification settings - Fork 0
/
accept-candidate.php
30 lines (27 loc) · 1.27 KB
/
accept-candidate.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
<?php
include('connection.php');
if ($_SERVER["REQUEST_METHOD"] == "GET") {
// Retrieve parameters from the URL
$CandidateID = $_GET['CandidateID'];
$SectionBatch = $_GET['SectionBatch'];
// Move candidate data from applyCandidate table to candidates table
$moveToCandidatesQuery = "INSERT INTO candidates (CandidateName, CandidateID, Symbol, SectionBatch)
SELECT CandidateName, CandidateID, Symbol, SectionBatch
FROM applyCandidate
WHERE CandidateID = '$CandidateID' AND SectionBatch = '$SectionBatch'";
if (mysqli_query($conn, $moveToCandidatesQuery)) {
// Candidate accepted, now delete from applyCandidate table
$deleteFromApplyQuery = "DELETE FROM applyCandidate WHERE CandidateID = '$CandidateID' AND SectionBatch = '$SectionBatch'";
if (mysqli_query($conn, $deleteFromApplyQuery)) {
header('location: dashboard.php'); // Redirect to candidates.php or wherever you want
exit();
} else {
echo "Error deleting candidate: " . mysqli_error($conn);
}
} else {
echo "Error accepting candidate: " . mysqli_error($conn);
}
// Close the database connection
mysqli_close($conn);
}
?>