-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsave_marks.php
More file actions
35 lines (30 loc) · 1.11 KB
/
save_marks.php
File metadata and controls
35 lines (30 loc) · 1.11 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
<?php
// Database connection
$conn = new mysqli('localhost', 'root', '', 'erp');
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Get form data
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$class = $_POST['class'];
$academic_year = $_POST['academic_year'];
$exam_type = $_POST['exam_type'];
$physics = $_POST['physics'];
$chemistry = $_POST['chemistry'];
$biology = $_POST['biology'];
$maths = $_POST['maths'];
$english = $_POST['english'];
$sst = $_POST['sst'];
$hindi = $_POST['hindi'];
$computers = $_POST['computers'];
// Insert data
$sql = "INSERT INTO student_marks (first_name, last_name, class, academic_year, exam_type, physics, chemistry, biology, maths, english, sst, hindi, computers)
VALUES ('$first_name', '$last_name', '$class', '$academic_year', '$exam_type', '$physics', '$chemistry', '$biology', '$maths', '$english', '$sst', '$hindi', '$computers')";
if ($conn->query($sql) === TRUE) {
echo "Marks saved successfully!";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>