-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo02.php
44 lines (37 loc) · 1.47 KB
/
demo02.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>demo02</title>
</head>
<body>
<div style="width: 800px; height: 500px; ">
<div style="float: left;">分数:</div>
<div style="width: 300px;float: left;">
<form action="demo02.php" method="post">
<input type="text" name="shuzi" max="100" min="0">
<input type="submit" value="搜索" name="sousuo">
</form>
</div>
<div style="float: left;">
<?php
$shuzi = $_POST['shuzi']; #使用$_POST全局变量获取表单中提交的数据
if ($shuzi >= "90" && $shuzi <= "100") #使用if循环判断是否达到成绩线
{
echo "学生的分数是: $shuzi 可以升本"; #如果达到了,则运行输出,如果达不到就运行下一个循环111
}
elseif ($shuzi >= "80" && $shuzi <= "89") {
echo "学生的分数是: $shuzi 可以获得奖学金";
}
elseif ($shuzi >= "70" && $shuzi <= "79") {
echo "学生的分数是: $shuzi 可以免费获得试卷一套";
}
elseif ($shuzi < "70") {
echo "学生的分数是: $shuzi 学生成绩必须是100-70分";
}
?>
</div>
</div>
</body>
</html>