-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgradeInput.php
More file actions
148 lines (147 loc) · 5.78 KB
/
Copy pathgradeInput.php
File metadata and controls
148 lines (147 loc) · 5.78 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
<!DOCTYPE html>
<?php
session_start();
if (isset($_SESSION["IsLogin"]) && $_SESSION["IsLogin"] === 1) {
//echo "欢迎来到教师管理系统,";
//echo "当前用户".$_SESSION["username"];
}
?>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
<link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<title>
成绩录入
</title>
<style>
body {
background-image: url("bb.jpg");
background-position: center;
background-size: cover;
background-attachment: fixed;
}
</style>
</head>
<body>
<div>
<nav class="navba navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="teacherIndex.php">教师管理</a>
</div>
<div>
<ul class="nav navbar-nav">
<li><a href="mystudent.php">学生信息</a></li>
<li><a href="courseInfo.php">课程信息</a></li>
<li><a href="gradeInput.php">录入成绩</a></li>
<li><a href="login.php">退出</a></li>
</ul>
</div>
</div>
</nav>
</div>
<h1 align="center">成绩录入</h1>
<hr>
<br>
<div class="container">
<form class="form-inline" role="form" method="post">
<div class="form-group">
<?php
require "connect.inc.php";
$sql3 = "select DISTINCT km from c,e where gh='" . $_SESSION["username"] . "'and c.kh=e.kh";
$result3 = $conn->query($sql3);
?>
<select class="form-control" name="kname">
<?php
if ($result3->num_rows > 0) {
while ($row3 = $result3->fetch_assoc()) {
?>
<option><?php echo $row3["km"] ?></option>
<?php
}
}
?>
</select>
<button type="submit" class="btn btn-default" name="sub1">查询</button>
<input type="text" class="form-control" name="xh" placeholder="输入学号"/>
<input type="text" class="form-control" name="pscj" placeholder="输入平时成绩"/>
<input type="text" class="form-control" name="kscj" placeholder="输入考试成绩"/>
<input type="text" class="form-control" name="zb" placeholder="平时成绩比例"/>
<!-- <input type="text" class="form-control" name="zpcj" placeholder="输入总评成绩"/>-->
<button type="submit" class="btn btn-default" name="sub2">修改成绩</button>
</div>
</form>
<br>
<!-- 查询成绩-->
<table class="table">
<thead>
<th>学号</th>
<th>姓名</th>
<th>课程名</th>
<th>平时成绩</th>
<th>考试成绩</th>
<th>总评成绩</th>
</thead>
<?php
require "connect.inc.php";
if (isset($_POST["sub1"])) { //查询所有学生的成绩
$_SESSION["km"] = $_POST["kname"]; //根据选择的课程名查询
$sql4 = "select e.xh,s.xm,c.km,e.pscj,e.kscj,e.zpcj from e ,c,s where e.xh=s.xh and e.kh=c.kh and c.km='" . $_POST["kname"] . "'and e.gh='" . $_SESSION["username"] . "'";
$result4 = $conn->query($sql4);
if ($result4->num_rows > 0) {
// 输出数据
while ($row4 = $result4->fetch_assoc()) {
?>
<tr>
<td><?php echo $row4["xh"] ?></td>
<td><?php echo $row4["xm"] ?></td>
<td><?php echo $row4["km"] ?></td>
<td><?php echo $row4["pscj"] ?></td>
<td><?php echo $row4["kscj"] ?></td>
<td><?php echo $row4["zpcj"] ?></td>
</tr>
<?php
}
}
}
require "connect.inc.php";
if (isset($_POST["sub2"])) {
$km = $_SESSION["km"];
$pscj = $_POST["pscj"];
$kscj = $_POST["kscj"];
// $zpcj = ($pscj * $_POST["zb"] + $kscj * (1 - $_POST["zb"]));
$sql1 = "update xishu set ratio='" . $_POST["zb"] . "'";
$conn->query($sql1);
$sql5 = "update e set pscj='" . $_POST["pscj"] . "',kscj='" . $_POST["kscj"] . "' where xh='" . $_POST["xh"] . "'and kh in(select kh from c where km='" . $_SESSION["km"] . "')";
if ($conn->query($sql5)) {
$sql4 = "select e.xh,s.xm,c.km,e.pscj,e.kscj,e.zpcj from e ,c,s where e.xh=s.xh and e.kh=c.kh and c.km='" . $_SESSION["km"] . "'and e.gh='" . $_SESSION["username"] . "'";
$result4 = $conn->query($sql4);
if ($result4->num_rows > 0) {
// 输出数据
while ($row4 = $result4->fetch_assoc()) {
?>
<tr>
<td><?php echo $row4["xh"] ?></td>
<td><?php echo $row4["xm"] ?></td>
<td><?php echo $row4["km"] ?></td>
<td><?php echo $row4["pscj"] ?></td>
<td><?php echo $row4["kscj"] ?></td>
<td><?php echo $row4["zpcj"] ?></td>
</tr>
<?php
}
}
?>
<script>
window.alert("修改成功")
</script>
<?php
}
}
?>
</table>
</div>
</body>
</html>