翼度科技»论坛 编程开发 PHP 查看内容

基于php+mysql的期末作业小项目(学生信息管理系统)

4

主题

4

帖子

12

积分

新手上路

Rank: 1

积分
12
前言

一个简单的php➕mysql项目学生信息管理系统,用于广大学子完成期末作业的参考,该系统实现增、删、改、查等基本功能。

1、登录界面

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>无标题文档</title>
  6.         <link rel="stylesheet" type="text/css" href="login.css" rel="external nofollow" >
  7. </head>

  8. <body>
  9. <div class="login">       
  10.         <h2 class="BT">Login</h2>
  11.         <div class="zm">
  12. <form action="function.php?action=login" method="post">
  13. 账号:<input type="number"  name="user">


  14. 密码:<input type="password"  name="password">
  15. <p>没有账号?点击<a href="newuser.php" rel="external nofollow" >注册</a></p>
  16. <div>
  17. <input type="submit" value="登录"  class="dl"><input type="reset" value="重置" class="cz">       
  18. </div>
  19. </form>
  20. </div>
  21. </div>
  22. </body>
  23. </html>
复制代码
当输入密码点击登录后会弹出“登录成功”或者“账号或密码有错误提示”


2、注册界面

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>无标题文档</title>
  6. <link rel="stylesheet" type="text/css" href="newuser.css" rel="external nofollow" >       
  7. </head>

  8. <body>
  9.         <div class="l">
  10. <img src="微信图片_20220530195333333png.png" width="100px"  height="100px">
  11. <h3>学生成绩管理系统</h3>
  12.        
  13. </div>
  14.         <div style=" height: 130px;  " > <a href="login.php" rel="external nofollow"  class="ll"  ></a></div>
  15. <div class="zc" style="padding-left: 30px;">
  16.         <h2 align="center" style="color:#D6CFCF;">DeleteStudent</h2>

  17. <form method="post" action="">
  18. 账       号:<input type="number" class="id" name="id">       

  19. 密       码:<input type="password" class="password" name="password">

  20. 确认密码:<input type="password" class="repassword" name="repassword">

  21.         <input type="submit" class="tj" value="注册" name="tj">
  22.         </form>       
  23.         </div>
  24.         <?php
  25.         include("connection.php");
  26.         if(isset($_POST["tj"])){
  27.                 $id=$_POST["id"];
  28.                 $password=$_POST["password"];
  29.                 $repassword=$_POST["repassword"];
  30.                 if($password==$repassword){
  31.                 connection();
  32.                 $sql="insert into user(userid,password)values('".$id."','".$password."')";       
  33.                 $result=mysql_query($sql);
  34.                         echo "<script>alert('注册成功!');location='login.php'</script>";
  35.                 }else{
  36.                         echo "<script>alert('密码不一致');location='newuser.php'</script>";
  37.                        
  38.                 }
  39.         }
  40.         ?>
  41. </body>
  42. </html>
复制代码
当输入密码点击注册后会弹出“注册成功”或者“密码不一致”或者账号密码不为空提示·

点击图上的小房子可以返回登录界面

3、主界面

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>无标题文档</title>
  6. <link rel="stylesheet" type="text/css" href="main.css">
  7. </head>

  8. <body>
  9. <div class="l">
  10. <img src="微信图片_20220530195333333png.png" width="100px"  height="100px" >
  11. <h3>学生信息管理系统</h3>
  12. </div>
  13.         <div style=" height: 130px; "> <a href="login.php" class="ll"  ></a></div>
  14.         <h3  style="padding-left: 48%;padding-top: 0px; color: aquamarine; height: 30px;line-height: 29px;"><a href="table.php" style="text-decoration: none; color: aqua;" class="a3">学生表</a></h3>
  15.         <div class="nav">
  16.                
  17.         <a href="select.php" class="bg1">查询学生信息</a>
  18.         <a href="update.php" class="bg2">修改学生信息</a>
  19.         <a href="delete.php"class="bg3" >删除学生信息</a>
  20.         <a href="adding.php"class="bg4">添加学生信息</a>
  21.    
  22.     </div>
  23. </body>
  24. </html>
复制代码
4、学生表界面

点击主界面上的“学生表”可以进入学生表界面
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>无标题文档</title>
  6. <link rel="stylesheet" type="text/css" href="table.css">       
  7.                
  8. </head>
  9. <body>
  10. <div class="l" ">
  11. <img src="微信图片_20220530195333333png.png" width="100px"  height="100px" >
  12. <h3>学生信息管理系统</h3>
  13.        
  14. </div>
  15. <div style=" height: 130px; "> <a href="main.php" class="ll"  ></a></div>                                                                                                                                          
  16. <h2 align="center" >学生表</h2><br>
  17.         <table align="center" border="1" cellpadding="0 " cellspacing="0" width="700" style="margin: 0px auto;">
  18.         <tr align="center"  height="30px">
  19.                 <td>姓名</td>
  20.                 <td>性别</td>
  21.                 <td>年龄</td>
  22.                 <td>学号</td>
  23.                 <td>联系方式</td>
  24.         </tr>
  25.        
  26.         <?PHP
  27.         include("connection.php");
  28.         connection();
  29.         $sql="select * from studenttable ";
  30. mysql_query("SET CHARACTER SET utf-8");
  31.     $result=mysql_query($sql);
  32.         while($row=mysql_fetch_assoc($result)){
  33.                 echo("<tr align='center' height='30px'>");
  34.                 echo("<td>".$row['Name']."</td>");
  35.                 echo("<td>".$row['Sex']."</td>");
  36.                 echo("<td>{$row['Age']}</td>");
  37.                 echo("<td>{$row['Sno']}</td>");
  38.                 echo("<td>{$row['TelphoneNumber']}</td>");

  39.    echo("</tr>");
  40.                 }
  41.         ?>
  42.         </table>
  43. </body>
  44. </html>
复制代码
点击图上的小房子可以返回主界面

5 、查询学生界面

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>无标题文档</title>
  6.         <link rel="stylesheet" type="text/css" href="select.css">       
  7. </head>

  8. <body>
  9.                 <div class="l">
  10. <img src="微信图片_20220530195333333png.png" width="100px"  height="100px">
  11. <h3>学生成绩管理系统</h3>
  12.        
  13. </div>
  14.         <div style=" height: 130px; "> <a href="main.php" class="ll"  ></a></div>
  15.         <div class="zc" style="padding-left: 30px;">
  16.         <h2 align="center" style="color:#D6CFCF;">SelectStudent</h2><br>
  17. <form method="post" action="">
  18. 学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号:<input type="number" class="name" name="sno">        <br><br>
  19.         <input type="submit" class="tj" value="查询" name="cx" >
  20.         </form>       
  21.         </div>
  22.         <table align="center" border="1" cellpadding="0 " cellspacing="0" width="700" style="margin: 0px auto;">
  23.         <tr align="center"  height="30px">
  24.                 <td>姓名</td>
  25.                 <td>性别</td>
  26.                 <td>年龄</td>
  27.                 <td>学号</td>
  28.                 <td>联系方式</td>
  29.         </tr>
  30.        
  31.         <?PHP
  32.         include("connection.php");
  33.        
  34.         connection();
  35.                 if(isset($_POST["cx"])){
  36.                 $Sno=$_POST["sno"];
  37.         $sql=$sql="select * from studenttable where Sno='".$Sno."'";
  38. mysql_query("SET CHARACTER SET utf-8");
  39.     $result=mysql_query($sql);
  40.                         if(mysql_num_rows($result)>0)
  41.         {
  42.                 echo "<script>alert('查询成功!');</script>";
  43.         }else{
  44.                                
  45.                 echo "<script>alert('学号不存在!');</script>";               
  46.                                
  47.                         }
  48.                                
  49.         while($row=mysql_fetch_assoc($result)){
  50.                 echo("<tr align='center' height='30px'>");
  51.                 echo("<td>".$row['Name']."</td>");
  52.                 echo("<td>".$row['Sex']."</td>");
  53.                 echo("<td>{$row['Age']}</td>");
  54.                 echo("<td>{$row['Sno']}</td>");
  55.                 echo("<td>{$row['TelphoneNumber']}</td>");

  56.    echo("</tr>");}
  57.                        
  58.     }               
  59. ?>
  60.         </table>
  61. </body>
  62. </html>
复制代码
点击图上的小房子可以返回主界面

6、修改学生信息界面

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>无标题文档</title>
  6.         <link rel="stylesheet" type="text/css" href="update.css">       
  7. </head>

  8. <body>
  9.         <div class="l">
  10. <img src="微信图片_20220530195333333png.png" width="100px"  height="100px">
  11. <h3>学生成绩管理系统</h3>
  12.        
  13. </div>
  14.         <div style=" height: 130px;  " > <a href="main.php" class="ll"  ></a></div>
  15. <div class="zc" style="padding-left: 30px;">
  16.         <h2 align="center" style="color:#D6CFCF;">UpdateStudent</h2><br>
  17. <form method="post" action="">
  18. 姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名:<input type="text" class="name" name="name">        <br><br>学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号:<input type="number" class="sno" name="sno"><br><br>
  19. 性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别:<input type="radio" class="sex" name="sex" value="男" checked>男<input type="radio" class="sex" name="sex" value="女">女        <br><br>
  20. 年&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;龄:<input type="number" class="age" name="age"><br><br>
  21. 联系方式:&nbsp;&nbsp;<input type="tel" class="telphone" name="telphone"><br>
  22.         <input type="submit" class="tj" value="修改" name="tj">
  23.         </form>       
  24.         </div>
  25.         <?php
  26.         include("connection.php");
  27.         if(isset($_POST["tj"])){
  28.                 $Name=$_POST["name"];
  29.                 $Sno=$_POST["sno"];
  30.                 connection();
  31.                 $sql="select * from studenttable where Name='".$Name."' and Sno='".$Sno."'";       
  32.                 $result=mysql_query($sql);
  33.                 if(mysql_num_rows($result)>0){
  34.                         $Name=$_POST["name"];
  35.                 $Sno=$_POST["sno"];
  36.                         $Sex=$_POST["sex"];
  37.                         $Age=$_POST["age"];
  38.                         $tel=$_POST["telphone"];
  39.                         $sql="update studenttable set Sex='".$Sex."',Age='".$Age."',TelphoneNumber='".$tel."'where Sno='".$Sno."' and Name='".$Name."'";
  40.                         mysql_query($sql)or die(mysql_error());
  41.                                 echo("<script>alert('修改成功');window.location.href='table.php';</script>");
  42.                                
  43.                         }
  44.                         else{
  45.                                
  46.                                 echo("<script>alert('学号或姓名不存在');</script>");
  47.                                
  48.                         }
  49.         }
  50.                
  51.         ?>
  52. </body>
  53. </html>
复制代码
点击图上的小房子可以返回主界面

7、删除学生信息界面

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>无标题文档</title>
  6.         <link rel="stylesheet" type="text/css" href="delete.css">
  7.        
  8. </head>

  9. <body>
  10.         <div class="l">
  11. <img src="微信图片_20220530195333333png.png" width="100px"  height="100px">
  12. <h3>学生成绩管理系统</h3>
  13.        
  14. </div>
  15.         <div style=" height: 130px;  " > <a href="main.php" class="ll"  ></a></div>
  16. <div class="zc" style="padding-left: 30px;">
  17.         <h2 align="center" style="color:#D6CFCF;">DeleteStudent</h2><br>
  18. <form method="post" action="">
  19. 姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名:<input type="text" class="name" name="name">        <br><br>学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号:<input type="number" class="sno" name="sno"><br><br>
  20.         <input type="submit" class="tj" value="删除" name="tj">
  21.         </form>       
  22.         </div>
  23.         <?php
  24.         include("connection.php");
  25.         if(isset($_POST["tj"])){
  26.                 $Name=$_POST["name"];
  27.                 $Sno=$_POST["sno"];
  28.                 connection();
  29.                 $sql="select * from studenttable where Name='".$Name."' and Sno='".$Sno."'";       
  30.                 $result=mysql_query($sql);
  31.                 if(mysql_num_rows($result)>0){
  32.                         $Name=$_POST["name"];
  33.                 $Sno=$_POST["sno"];
  34.                         $sql="delete from  studenttable where Sno='".$Sno."' and Name='".$Name."'";
  35.                         mysql_query($sql)or die(mysql_error());
  36.                                 echo("<script>alert('删除成功');window.location.href='table.php';</script>");
  37.                                
  38.                         }
  39.                         else{
  40.                                
  41.                                 echo("<script>alert('学号或姓名不存在');</script>");
  42.                                
  43.                         }
  44.         }
  45.                
  46.         ?>
  47. </body>
  48. </html>
复制代码
点击图上的小房子可以返回主界面

8、添加学生信息界面


点击图上的小房子可以返回主界面

9、后台数据库




总结

到此这篇关于基于php+mysql的期末作业小项目的文章就介绍到这了,更多相关php mysql学生信息管理系统内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

来源:https://www.jb51.net/article/272190.htm
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x

举报 回复 使用道具