-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd-student.php
81 lines (59 loc) · 2.47 KB
/
add-student.php
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
<?php
require_once('connection/connection.php');
session_start();
if (empty($_SESSION['username'])) {
header('location:login.php');
}
?>
<!DOCTYPE html>
<html lang="en">
<!-- include your header here -->
<?php include('includes/header.php'); ?>
<body>
<main>
<!-- include your menubar here -->
<?php include('includes/navbar.php'); ?>
<div class="container">
<div class="row mb-3">
<div class="col-md-12 mt-5">
<div class="col-md-4 form-signin">
<h1 class="h3 mb-3 fw-normal">Add Student</h1>
<hr><br>
<?php
if (isset($_POST['save'])) {
$fname = $_POST['fname'];
$mname = $_POST['mname'];
$lname = $_POST['lname'];
$result = $con->prepare("INSERT INTO studinfo (fname,mname,lname) VALUES (?,?,?)")
->execute([$fname, $mname, $lname]);
if ($result) {
header('location:index.php');
} else {
echo "error";
}
}
?>
<form method="post">
<div class="form-group mb-3">
<label>First Name</label>
<input type="text" class="form-control" name="fname" required>
</div>
<div class="form-group mb-3">
<label>Middle Name</label>
<input type="text" class="form-control" name="mname" required>
</div>
<div class="form-group mb-3">
<label>Last Name</label>
<input type="text" class="form-control" name="lname" required>
</div>
<div class="form-group mb-3">
<input type="submit" class="btn btn-success btn-lg" name="save" value="Save">
</div>
</form>
</div>
</div>
</div>
</div>
</main>
</body>
</html>