-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate3.php
More file actions
26 lines (21 loc) · 767 Bytes
/
validate3.php
File metadata and controls
26 lines (21 loc) · 767 Bytes
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
<?php
include('DB_connect.php');
if (isset($_GET['student_id']) && !empty($_GET['student_id'])) {
$student_id = intval($_GET['student_id']);
$query = "SELECT student_number FROM students WHERE student_id = ?";
$stmt = $connect->prepare($query);
$stmt->bind_param('i', $student_id);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
echo '<option value="' . htmlspecialchars($row['student_number']) . '">' . htmlspecialchars($row['student_number']) . '</option>';
} else {
echo '<option value="">No admission number found</option>';
}
$stmt->close();
} else {
echo '<option value="">Invalid student ID</option>';
}
$connect->close();
?>