-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_teacher.php
72 lines (56 loc) · 2.38 KB
/
add_teacher.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
<?php
require 'require.php';
require 'session.php';
if(!isset($_SESSION['login_admin']))
{
header("Location: index.php");
}
?>
<?php
if(isset($_POST['fid']) && isset($_POST['tname']) && isset($_SESSION['dept']) && !empty($_POST['fid']) && !empty($_POST['tname']) && !empty($_SESSION['dept']))
{
$fid = $_POST['fid'];
$tname = $_POST['tname'];
$dept = $_SESSION['dept'];
$add_query = "INSERT INTO teachers_info (fid, tname, dept) VALUES('$fid','$tname','$dept')";
$add_result = mysql_query($add_query) or die(mysql_error());
$report_add_query = "INSERT INTO teacher_report (fid) VALUES ('$fid')";
$report_result = mysql_query($report_add_query) or die(mysql_error());
if($add_result && $report_result)
{
echo '<script>';
echo 'alert("Faculty added successfully !");';
echo '</script>';
}
}
?>
<html>
<head>
<title>Add Faculty</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body style="font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; vertical-align: middle; text-align: center;">
<div id="logout">
<a href="logout.php"><input type="button" value="Log Out" id="button" /></a>
</div>
<div style="background: linear-gradient(rgb(255, 255, 255),rgba(0, 0, 0, 0.10)); padding: 20px; width: 70%; margin: auto; margin-top: 50px; box-shadow: 0 0 5px rgba(0, 0, 0, 0.6); border-radius: 20px;text-align:center;">
<p>
Add Faculty :
</p>
<form action="add_teacher.php" method="POST" style="text-align:center;">
<div>
<div style="margin:10px auto 10px auto;">
Faculty ID :
<input type="number" name="fid" min=0 required autofocus />
</div>
<div style="margin:10px auto 10px auto;">
Faculty Name :
<input type="text" name="tname" required />
</div>
</div>
<input type="submit" value="Add" />
</form>
<br /><input type="button" onclick="location.href='admin_panel.php';" value="Go Back" />
</div>
</body>
</html>