-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmit_admission.php
More file actions
38 lines (34 loc) · 1.14 KB
/
submit_admission.php
File metadata and controls
38 lines (34 loc) · 1.14 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
<?php
require 'config.php';
session_start();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$data = [
'name' => htmlspecialchars($_POST['name']),
'father' => htmlspecialchars($_POST['father']),
'mother' => htmlspecialchars($_POST['mother']),
'dob' => $_POST['dob'],
'address' => htmlspecialchars($_POST['address']),
'phone' => $_POST['phone'],
'whatsapp' => isset($_POST['same_whatsapp']) ? $_POST['phone'] : $_POST['whatsapp'],
'class' => (int)$_POST['class'],
'school' => htmlspecialchars($_POST['school'])
];
$stmt = $pdo->prepare("INSERT INTO admission_requests
(student_name, father_name, mother_name, dob, address, phone, whatsapp, class, school)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->execute([
$data['name'],
$data['father'],
$data['mother'],
$data['dob'],
$data['address'],
$data['phone'],
$data['whatsapp'],
$data['class'],
$data['school']
]);
$_SESSION['message'] = "Admission request submitted successfully!";
header("Location: index.php");
exit;
}
?>