-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_student.php
28 lines (26 loc) · 1.84 KB
/
update_student.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
<?php
require('connect.php');
try {
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
extract($_POST);
if (!empty($studentname)) {
$stmt = $conn->prepare("UPDATE students SET assignee = :assignee, studentname = :studentname, tags = :tags, reference = :reference, lastdegree = :lastdegree, engtst = :engtst, tbtst = :tbtst, unifee = :unifee, consltfee = :consltfee, cas_applied = :cas_applied, cas_received = :cas_received, docsurl = :docsurl, missingdocs = :missingdocs, note = :note, email = :email, proceeding_uni = :proceeding_uni, number = :number, priority = :priority, unitst = :unitst, bankstatement = :bankstatement, visa = :visa, status =:status WHERE id = :id");
$stmt->execute(['assignee' => $assignee, 'studentname' => $studentname, 'tags' => $tags, 'reference' => $reference, 'lastdegree' => $lastdegree, 'engtst' => $engtst, 'tbtst' => $tbtst, 'unifee' => $unifee, 'consltfee' => $consltfee, 'cas_applied' => $cas_applied, 'cas_received' => $cas_received, 'docsurl' => $docsurl, 'missingdocs' => $missingdocs, 'note' => $note, 'email' => $email, 'proceeding_uni' => $proceeding_uni, 'number' => $number, 'priority' => $priority, 'unitst' => $unitst, 'bankstatement' => $bankstatement, 'visa' => $visa, 'status' => $status, 'id' => $id]);
$response = ['message' => 'Updated Successfully'];
http_response_code(200);
} else {
// Invalid request parameters
$response = ['message' => 'Invalid request parameters'];
http_response_code(400);
}
} else {
// Invalid request method
$response = ['message' => 'Invalid request method'];
http_response_code(405);
}
// Return the response as JSON
echo json_encode($response);
} catch (PDOException $e) {
echo $e->getMessage();
}
$conn = null;