-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmidsem_marks1.php
More file actions
155 lines (133 loc) · 4.13 KB
/
midsem_marks1.php
File metadata and controls
155 lines (133 loc) · 4.13 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php
// Database connection
include "connecting.php";
// Start session
session_start();
//added a comment to check github
// Fetch professor's username from session
$username = $_SESSION['username'];
// Get POST data from previous page
$department_id = $_POST['department_id'];
$semester_id = $_POST['semester_id'];
$course_id = $_POST['course_id'];
// Fetch professor_id using username
$professor_query = $conn->query("SELECT professor_id FROM professors WHERE username='$username'");
if ($professor_query->num_rows > 0) {
$professor_row = $professor_query->fetch_assoc();
$professor_id = $professor_row['professor_id'];
} else {
die("Professor not found.");
}
// Fetch students for the selected department and semester
$students = $conn->query("SELECT student_id, first_name, last_name FROM students WHERE department_id='$department_id' AND semester_id='$semester_id'");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Upload Marks</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Roboto', sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 0;
}
.container {
width: 80%;
margin: 50px auto;
background-color: white;
padding: 30px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
border-radius: 8px;
}
h1 {
text-align: center;
color: #333;
}
table {
width: 100%;
margin-bottom: 20px;
border-collapse: collapse;
}
th, td {
padding: 12px;
text-align: left;
border: 1px solid #ddd;
}
th {
background-color: #007bff;
color: white;
}
td input {
width: 100%;
padding: 8px;
margin: 5px 0;
border: 1px solid #ddd;
border-radius: 4px;
}
.form-group {
margin-top: 20px;
display: flex;
justify-content: space-between;
align-items: center;
}
.form-group label {
font-weight: 500;
font-size: 1rem;
color: #333;
}
.form-group input {
width: 150px;
}
button {
padding: 10px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 1rem;
width: 100%;
margin-top: 20px;
}
button:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="container">
<h1>Upload Mid Semester Marks</h1>
<form action="upload_marks.php" method="POST">
<table>
<thead>
<tr>
<th>Student Name</th>
<th>Marks Obtained</th>
</tr>
</thead>
<tbody>
<?php while ($row = $students->fetch_assoc()) { ?>
<tr>
<td><?= $row['first_name'].' '.$row['last_name'] ?></td>
<td>
<input type="number" name="marks[<?= $row['student_id'] ?>]" min="0" required>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<div class="form-group">
<label for="outof_marks">Out of Marks:</label>
<input type="number" id="outof_marks" name="outof_marks" required>
</div>
<input type="hidden" name="course_id" value="<?= $course_id ?>">
<input type="hidden" name="professor_id" value="<?= $professor_id ?>">
<button type="submit">Submit Marks</button>
</form>
</div>
</body>
</html>