php考试成绩评定标准
php考试成绩评定标准
通过if语句对文本输入框的考试成绩进行评定。当单价评定按钮时,利用POST方法接收数据,并利用if语句对接收的数据进行判断。
实列代码:
<?php if(!empty($_POST['sub'])) { $mark = trim($_POST['text']); if($mark == 100){ echo "优秀"; } if ($mark>=60 && $mark <100) { echo "良好"; } if ($mark>=0 && $mark < 60) { echo "不及格"; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <form action="" method="post"> <input type="text" name="text"> <input type="submit" name="sub" value="评定"> </form> </body> </html>
运行结果:
上一篇:php员工生日提醒
下一篇:php模拟数据库常用操作效果