-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
60 lines (55 loc) · 2.14 KB
/
index.php
File metadata and controls
60 lines (55 loc) · 2.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!--
MADE BY GROUP C SOFTWARE ENGINEERING EVENING
TULINAWE ISMAIL 23/U/18058/EVE
BONABAANA BRONIA -> 23/U/07647/EVE
MWESIGWA ARNOLD -> 23/U/24738/PS
NAISANGA PATRICK 23/U/13204/EVE
NAKYAMBADE MARIAM -> 23/U/13953/EVE
-->
<!--
1. THIS IS A PURE HTML FILE THAT IMPORTS STYLES.CSS FOR THE STYLING OF THE CONTAINER
2. THE DELETE FUNCTION IS CALLED WHEN A BUTTON CONTAINING THE STUDENTS
DETAILS PASSING THE ID, WHICH IS PASSED TO DELETE.PHP TO DELETE THE
THE RECORD FROM THE DATABASE. IT WILL WAIT FOR THE DELETE TO EXECUTE
AND WILL RETURN THE RESULT, THEN RESPONSE PARSED TO TEXT
THEN THE DATA PARSED TO THE TABLE
3. WHEN THE SUBMIT BUTTON IS PRESSED,FIRST ALL REQUIRED ELEMENTS MUST BE FILLED
AND HANDLED BY SUBMIT.PHP FILE USING POST METHOD
4. THE DIV CONTAINING REGISTERED STUDENTS IS FILLED WITH A TABLE IN FETCH.PHP
THATS ALL
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Registration</title>
<link rel="stylesheet" href="styles.css">
<script>
function deleteStudent(id) {
if (confirm("Are you sure you want to delete this record?")) {
fetch(`delete.php?id=${id}`)
.then(response => response.text())
.then(data => {
document.getElementById("studentTable").innerHTML = data;
});
}
}
</script>
</head>
<body>
<div class="container">
<h2>Student Registration Form</h2>
<form action="submit.php" method="POST">
<input type="text" name="name" placeholder="Name" required>
<input type="number" name="age" placeholder="Age" required>
<input type="text" name="reg_no" placeholder="Registration Number" required>
<button type="submit">Submit</button>
</form>
<h2>Registered Students</h2>
<div id="studentTable">
<?php include 'fetch.php'; ?>
</div>
</div>
</body>
</html>