学生资料管理系统php+mysql
发布时间:2023-03-13 14:10:22 所属栏目:教程 来源:
导读:界面与其代码
1.主界面(index.PHP)
<html>
<head>
<title>学生信息管理系统</title>
</head>
<body>
<style type="text/css">
body{
background:url("bg.
1.主界面(index.PHP)
<html>
<head>
<title>学生信息管理系统</title>
</head>
<body>
<style type="text/css">
body{
background:url("bg.
界面与其代码 1.主界面(index.PHP) <html> <head> <title>学生信息管理系统</title> </head> <body> <style type="text/css"> body{ background:url("bg.png") no-repeat; background-size: 100%; } div{ font-size: 30px; font-weight: bold; color: #000000; margin-bottom: 15px; } </style> <div style="text-align: center;color: #000000;" >学生信息管理系统</div> <div style="text-align: center;color: #000000;"> <a href="bd.PHP" target="test">表单</a> <a href="cjcx.PHP" target="test">学生成绩查询</a> <a href="xsb.PHP" target="test">学生表管理</a> <a href="kcb.PHP" target="test">课程表管理</a> <a href="xk.PHP" target="test">选课系统</a> <a href="bk.PHP" target="test">补考名单</a> <tr> <td align="center" valign="middle"> <iframe src="" height="800px" width="1200px" name="test" id="test" scrolling="yes" frameborder="0"></iframe> </td> </tr> </div> </body> </html> 2.表单界面(bd.PHP) 在这里插入图片描述 <!DOCTYPE html> <html> <head> <Meta charset="UTF-8"> <title>补考</title> <style type="text/css"> table{margin:0 auto;} td{text-align:center;} </style> </head> <body> <h1 style="text-align: center;color: #000000;">学生表</h1> <table width="100%" border="1" cellpadding="0" cellspacing="0" height="21" bordercolor="#cccccc" style="border-collapse"> <tr backgorundcolor="#ffffff"> <td width="10%" ><p align="center">学号</td> <td width="10%" ><p align="center">姓名</td> <td width="10%" ><p align="center">性别</td> <td width="10%" ><p align="center">年龄</td> <td width="10%" ><p align="center">身份证</td> <td width="10%" ><p align="center">专业编号</td> <td width="10%" ><p align="center">班级</td> <td width="10%" ><p align="center">联系方式</td> <td width="10%" ><p align="center">家庭住址</td> <td width="10%" ><p align="center">备注</td> <tr> <?PHP $conn=MysqLi_connect("localhost", "root", "123456", "stumanage"); MysqLi_set_charset($conn, "set names 'utf8'"); $sql ="select * from student"; $result= MysqLi_query($conn, $sql); while($s=MysqLi_fetch_array($result)){ echo "<tr><td height=24>$s[0]</td>"; echo "<td height=24 >$s[1]</td>"; echo "<td height=24 >$s[2]</td>"; echo "<td height=24 >$s[3]</td>"; echo "<td height=24 >$s[4]</td>"; echo "<td height=24 >$s[5]</td>"; echo "<td height=24 >$s[6]</td>"; echo "<td height=24 >$s[7]</td>"; echo "<td height=24 >$s[8]</td>"; echo "<td height=24 >$s[9]</td>"; } echo "</tr>"; ?> <table width="100%" border="1" cellpadding="0" cellspacing="0" height="21" bordercolor="#cccccc" style="border-collapse"> <h1 style="text-align: center;color: #000000;">课程表</h1> <tr backgorundcolor="#ffffff"> <td width="10%" ><p align="center">学号</td> <td width="10%" ><p align="center">姓名</td> <td width="10%" ><p align="center">课程编号</td> <td width="10%" ><p align="center">课程名</td> <td width="10%" ><p align="center">分数</td> <tr> <?PHP $conn=MysqLi_connect("localhost", "set names 'utf8'"); $sql ="select * from course"; $result= MysqLi_query($conn, $sql); while($s=MysqLi_fetch_array($result)){ echo "<tr><td height=24>$s[0]</td>"; echo "<td height=24 >$s[1]</td>"; echo "<td height=24 >$s[2]</td>"; echo "<td height=24 >$s[3]</td>"; echo "<td height=24 >$s[4]</td>"; } echo "</tr>"; ?> <table width="100%" border="1" cellpadding="0" cellspacing="0" height="21" bordercolor="#cccccc" style="border-collapse"> <h1 style="text-align: center;color: #000000;">选课表</h1> <tr backgorundcolor="#ffffff"> <td width="10%" ><p align="center">课程编号</td> <td width="10%" ><p align="center">课程名</td> <td width="10%" ><p align="center">主编</td> <td width="10%" ><p align="center">出版社</td> <td width="10%" ><p align="center">成绩</td> <tr> <?PHP $conn=MysqLi_connect("localhost", "set names 'utf8'"); $sql ="select student.sno,sname,course.cno,cname,degree from student,sc,course where student.sno=sc.sno and sc.cno =course.cno order by sno"; $result= MysqLi_query($conn, $sql); while($s=MysqLi_fetch_array($result)){ echo "<tr><td height=24>$s[0]</td>"; echo "<td height=24 >$s[1]</td>"; echo "<td height=24 >$s[2]</td>"; echo "<td height=24 >$s[3]</td>"; echo "<td height=24 >$s[4]</td>"; } echo "</tr>"; ?> </body> </html> 3.学生成绩查询(cjcx.PHP) 在这里插入图片描述 <!DOCTYPE html> <html> <head> <Meta charset="UTF-8"> <title>成绩查询</title> <style type="text/css"> table{margin:0 auto;} td{text-align:center;} </style> </head> <body> <h1 style="text-align: center;color: #000000;">成绩查询</h1> <form name="frm1" method="post" > <table align="center" > <tr> <td width="100"><span>学生班级:</span></td> <td> <input name="sclass" id="sclass" type="text"> </td> <td width="100"><span>课程编号:</span></td> <td> <input name="cno" id="cno" type="text"> <input type="submit" name="test" value="查找"> </td> </tr> </table> </form> <br> <table width="100%" border="1" cellpadding="0" cellspacing="0" height="21" bordercolor="#cccccc" style="border-collapse"> <tr backgorundcolor="#ffffff"> <td width="15%" ><p align="center">班级</td> <td width="15%" ><p align="center">学号</td> <td width="20%" ><p align="center">姓名</td> <td width="15%" ><p align="center">课程号</td> <td width="20%" ><p align="center">课程名</td> <td width="15%" ><p align="center">分数</td> <tr> <?PHP $sno = @$_POST['sno']; $sclass = @$_POST['sclass']; $cno = @$_POST['cno']; $conn=MysqLi_connect("localhost", "set names 'utf8'"); $sql ="select sclass,student.sno,course where student.sclass='$sclass' and student.sno=sc.sno and sc.cno='$cno'and sc.cno =course.cno"; $result= MysqLi_query($conn, $sql); while($s=MysqLi_fetch_array($result)){ echo "<tr><td height=24>$s[0]</td>"; echo "<td height=24 >$s[1]</td>"; echo "<td height=24 >$s[2]</td>"; echo "<td height=24 >$s[3]</td>"; echo "<td height=24 >$s[4]</td>"; echo "<td height=24 >$s[5]</td>"; } echo "</tr>"; ?> </body> </html> 4.学生表管理(xsb.PHP) 在这里插入图片描述 <!DOCTYPE html> <html> <head> <Meta charset="UTF-8"> <title>学生信息更新</title> <style type="text/css"> table{margin:0 auto;} td{text-align:center;} </style> </head> <body> <h1 style="text-align: center;color: #000000;">学生表管理</h1> <form name="frm1" method="post" > <table align="center" > <tr> <td width="100"><span>根据学号查询:</span></td> <td> <input name="sno" id="sno" type="text"> <input type="submit" name="test" value="查找"> </td> </tr> </table> </form> <br> <?PHP $conn = MysqLi_connect("localhost", "set names 'utf8'"); session_start(); $number = @$_POST['sno']; $_SESSION['number']=$number; $sql = "select * from student where sno='$number'"; $result = MysqLi_query($conn, $sql); $row = @MysqLi_fetch_array($result); ?> <form name="frm2" method="post" enctype="multipart/form-data"> <table border="1" align="center"> <tr> <td><span>学号:</span></td> <td> <input name="sno" type="text" value="<?PHP echo $row['sno']; ?>"> <input name="h_sno" type="hidden" value="<?PHP echo $row['sno']; ?>"> </td> </tr> <tr> <td><span>姓名:</span></td> <td><input name="sname" type="text" value="<?PHP echo $row['sname']; ?>"></td> </tr> <tr> <td><span>性别:</span></td> <td><input name="ssex" type="text" value="<?PHP echo $row['ssex']; ?>"></td> </tr> <tr> <td><span>年龄:</span></td> <td><input name="sage" type="text" value="<?PHP echo $row['sage']; ?>"></td> </tr> <tr> <td><span>身份证号:</span></td> <td><input name="sid" type="text" value="<?PHP echo $row['sid']; ?>"></td> </tr> <tr> <td><span>专业编号:</span></td> <td><input name="sspeciality" type="text" value="<?PHP echo $row['sspeciality']; ?>"></td> </tr> <tr> <td><span>班级编号:</span></td> <td><input name="sclass" type="text" value="<?PHP echo $row['sclass']; ?>"></td> </tr> <tr> <td><span>联系方式:</span></td> <td><input name="sphone" type="text" value="<?PHP echo $row['sphone']; ?>"></td> </tr> <tr> <td><span>家庭住址:</span></td> <td><input name="saddress" type="text" value="<?PHP echo $row['saddress']; ?>"></td> </tr> <tr> <td><span>备注:</span></td> <td><input name="sremarks" type="text" value="<?PHP echo $row['sremarks']; ?>"></td> </tr> <td align="center" colspan="2"> <input name="b" type="submit" value="修改"> <input name="b" type="submit" value="添加"> <input name="b" type="submit" value="删除"> </td> </tr> </table> </form> </body> </html> <?PHP $num = @$_POST['sno']; $XH=@$_POST['sno']; $name = @$_POST['sname']; $XB = @$_POST['ssex']; $NL = @$_POST['sage']; $SFZH = @$_POST['sid']; $ZYBH = @$_POST['sspeciality']; $BJBH = @$_POST['sclass']; $LXFS = @$_POST['sphone']; $JTZZ = @$_POST['saddress']; $BZ = @$_POST['sremarks']; if (@$_POST["b"] == '修改') { if ($num!=$XH){ echo "<script>alert('学号与原数据有异,无法修改!');location.href='xsb.PHP'</script>"; } else { $update_sql="update student set sname='$name',ssex='$XB',sage='$NL',sid='$SFZH',sspeciality='$ZYBH',sclass='$BJBH',sphone='$LXFS',saddress='$JTZZ',sremarks='$BZ' where sno='$XH'"; $update_result= MysqLi_query($conn,$update_sql); if (MysqLi_affected_rows($conn) != 0){ echo "<script>alert('修改成功!');location.href='xsb.PHP'</script>"; } else { echo "<script>alert('修改失败!');location.href='xsb.PHP'</script>"; } } } if (@$_POST["b"] == '添加') { $insert_sql = "insert into student(sno,ssex,sage,sid,sspeciality,sclass,sphone,saddress,sremarks) values('$XH','$name','$XB','$NL','$SFZH','$ZYBH','$BJBH','$LXFS','$JTZZ','$BZ')"; $insert_result = MysqLi_query($conn, $insert_sql); if (MysqLi_affected_rows($conn) != 0){ echo "<script>alert('添加成功!');location.href='xsb.PHP'</script>"; } else { echo "<script>alert('添加失败!');location.href='xsb.PHP'</script>"; } } if (@$_POST["b"] == '删除') { if ($num==null) { echo "<script>alert('请输入要删除的学号!')</script>"; } else { $de_sql = "select sno from student where sno='$num'"; $de_result = MysqLi_query($conn, $de_sql); $de_row = MysqLi_fetch_array($de_result); if (!$de_row) echo "<script>alert('学号不存在,无法删除!')</script>"; else { $del_sql = "delete from student where sno='$num'"; $del_result = MysqLi_query($conn, $del_sql); if (MysqLi_affected_rows($conn) != 0) echo "<script>alert('删除学号为" . $num . "的学生成功!')</script>"; } } } ?> 5.课程表管理(kcb.PHP) 在这里插入图片描述 <html> <head> <Meta charset="UTF-8"> <title>课程信息更新</title> <style type="text/css"> table{margin:0 auto;} td{text-align:center;} </style> </head> <body> <h1 style="text-align: center;color: #000000;">课程表管理</h1> <form name="frm1" method="post"> <table align="center"> <tr> <td width="120"><span>根据课程号查询:</span></td> <td> <input name="cno" id="cno" type="text"> <input type="submit" name="test" value="查找"> </td> </tr> </table> </form> <?PHP $conn= MysqLi_connect("localhost","root","123456","stumanage"); MysqLi_set_charset($conn,"utf8"); $KCH=@$_POST['cno']; $sql="select * from course where cno='$KCH'"; $result= MysqLi_query($conn,$sql); $row=@MysqLi_fetch_array($result); if (($cno!=NULL)&&(!$row)) echo "<script>alert('没有该课程信息!')</script>"; ?> <form name="frm2" method="post"> <table border="1" align="center"> <tr> <td><span>课程编号:</span></td> <td> <input name="cno" type="text" value="<?PHP echo $row['cno'];?>"> <input name="h_cno" type="hidden" value="<?PHP echo $row['h_cno'];?>"> </td> </tr> <tr> <td><span>课程名:</span></td> <td><input name="cname" type="text" value="<?PHP echo $row['cname'];?>"></td> </tr> <tr> <td><span>主编:</span></td> <td><input name="ceditor" type="text" value="<?PHP echo $row['ceditor'];?>"></td> </tr> <tr> <td><span>出版社:</span></td> <td><input name="cpublish" type="text" value="<?PHP echo $row['cpublish'];?>"></td> </tr> <tr> <td><span>学分:</span></td> <td><input name="ccredit" type="text" value="<?PHP echo $row['ccredit'];?>"></td> </tr> <tr> <td align="center" colspan="2"> <input name="b" type="submit" value="修改"> <input name="b" type="submit" value="添加"> <input name="b" type="submit" value="删除"> </td> </tr> </table> </form> </body> </html> <?PHP $KCH=@$_POST['cno']; $h_KCH=@$_POST['cno']; $KCM=@$_POST['cname']; $ZB=@$_POST['ceditor']; $CBS=@$_POST['cpublish']; $XF=@$_POST['ccredit']; if (@$_POST["b"]=='修改') { if($KCH!=$h_KCH) echo "<script>alert('课程编号与原数据有异,无法修改!');</script>"; else { $update_sql="update course set cname='$KCM',ceditor='$ZB',cpublish='$CBS',ccredit='$XF' where cno='$KCH'"; $update_result= MysqLi_query($conn,$update_sql); if (MysqLi_affected_rows($conn)!=0) echo "<script>alert('修改成功!');</script>"; else echo "<script>alert('信息未修改!');</script>"; } } //单击【添加】按钮 if (@$_POST["b"]=='添加') { $insert_sql="insert into course(cno,ceditor,cpublish,ccredit) values('$KCH','$KCM','$ZB','$CBS','$XF')"; $insert_result= MysqLi_query($conn,$insert_sql)or die('添加失败!'); if(MysqLi_affected_rows($conn)!=0) echo "<script>alert('添加成功!');</script>"; } //单击【删除】按钮 if (@$_POST["b"]=='删除') { if(!$KCH) { echo "<script>alert('请输入要删除的课程号!');</script>"; } else { $d_sql="select cno from course where cno='$KCH'"; $d_result= MysqLi_query($conn,$d_sql); $d_row= MysqLi_fetch_array($d_result); if (!$d_row) echo "<script>alert('课程编号不存在,无法删除!');</script>"; else { $del_sql="delete from course where cno='$KCH'"; $del_result= MysqLi_query($conn,$del_sql)or die('删除失败!'); if (MysqLi_affected_rows($conn)!=0) echo "<script>alert('删除课程".$KCH."成功!');</script>"; } } } ?> 6.选课系统(xk.PHP) 在这里插入图片描述 <!DOCTYPE html> <html> <head> <Meta charset="UTF-8"> <title>补考</title> <style type="text/css"> table{margin:0 auto;} td{text-align:center;} </style> </head> <body> <h1 style="text-align: center;color: #000000;">选课表</h1> <table width="100%" border="1" cellpadding="0" cellspacing="0" height="21" bordercolor="#cccccc" style="border-collapse"> <tr backgorundcolor="#ffffff"> <td width="20%" ><p align="center">课程编号</td> <td width="20%" ><p align="center">课程名</td> <td width="20%" ><p align="center">老师</td> <td width="20%" ><p align="center">教学用书出版社</td> <td width="20%" ><p align="center">学分</td> </tr> <?PHP $conn=MysqLi_connect("localhost", $sql); while($s=MysqLi_fetch_array($result)){ echo "<tr><td height=24>$s[0]</td>"; echo "<td height=24 >$s[1]</td>"; echo "<td height=24 >$s[2]</td>"; echo "<td height=24 >$s[3]</td>"; echo "<td height=24 >$s[4]</td>"; } echo "</tr>"; ?> <form name="frm1" method="post" > <table align="center" > <h2><p style="text-align: center;color: #000000;">选课</h2></p> <tr> <td width="100"><span>选课学生学号:</span></td> <td> <input name="sno" id="sno" type="text"> </td> <td width="100"><span>所选课编号:</span></td> <td> <input name="cno" id="cno" type="text"> <input type="submit" name="test" value="选课"> </td> </tr> </table> <?PHP $sno = @$_POST['sno']; $cno = @$_POST['cno']; if (@$_POST["test"]=='选课') { $insert_sql="insert into sc(sno,cno) values('$sno','$cno')"; $insert_result= MysqLi_query($conn,$insert_sql)or die('添加失败!'); if(MysqLi_affected_rows($conn)!=0) echo "<script>alert('选课成功!');</script>"; } ?> </form> <h3 style="text-align: center;color: #000000;">修改选课</h3> <form name="frm1" method="post"> <table align="center"> <tr> <td width="100"><span>学号:</span></td> <td> <input name="sno" id="sno" type="text"> </td> <td width="100"><span>选错课程号:</span></td> <td> <input name="cno" id="cno" type="text"> <input type="submit" name="test" value="查找"> </td> </tr> </table> </form> <?PHP $conn= MysqLi_connect("localhost","utf8"); $cno=@$_POST['cno']; $sno=@$_POST['sno']; $sql="select * from sc where cno='$cno'AND sno='$sno'"; $result= MysqLi_query($conn,$sql); $row=@MysqLi_fetch_array($result); ?> <form name="frm2" method="post"> <table border="1" align="center"> <tr> <td><span>学号:</span></td> <td> <input name="sno" type="text" value="<?PHP echo $row[0];?>"> </td> </tr> <tr> <td><span>课程号:</span></td> <td><input name="cno" type="text" value="<?PHP echo $row[1];?>"></td> </tr> <tr> <td align="center" colspan="2"> <input name="b" type="submit" value="删除"> </td> </tr> </table> </form> </body> </html> <?PHP $sno=@$_POST['sno']; $cno=@$_POST['cno']; if (@$_POST["b"]=='删除') { if(!$cno) { echo "<script>alert('请输入要删除的课程号!');</script>"; } $del_sql="delete from sc where cno='$cno' and sno='$sno'"; $del_result= MysqLi_query($conn,$del_sql)or die('删除失败!'); if (MysqLi_affected_rows($conn)!=0) echo "<script>alert('删除成功!');</script>"; } ?> </body> </html> 7.补考名单(bk.PHP) 在这里插入图片描述 <!DOCTYPE html> <html> <head> <Meta charset="UTF-8"> <title>补考</title> <style type="text/css"> table{margin:0 auto;} td{text-align:center;} </style> </head> <body> <h1 style="text-align: center;color: #000000;">以下学生需要补考</h1> <table width="100%" border="1" cellpadding="0" cellspacing="0" height="21" bordercolor="#cccccc" style="border-collapse"> <tr backgorundcolor="#ffffff"> <td width="20%" ><p align="center">学号</td> <td width="20%" ><p align="center">姓名</td> <td width="20%" ><p align="center">课程号</td> <td width="20%" ><p align="center">课程名</td> <td width="20%" ><p align="center">分数</td> <tr> <?PHP $conn=MysqLi_connect("localhost", "set names 'utf8'"); $sql ="select sc.sno,sc.cno,course where sc.degree<60 and student.sno=sc.sno and sc.cno =course.cno order by sno"; $result= MysqLi_query($conn, $sql); while($s=MysqLi_fetch_array($result)){ echo "<tr><td height=24>$s[0]</td>"; echo "<td height=24 >$s[1]</td>"; echo "<td height=24 >$s[2]</td>"; echo "<td height=24 >$s[3]</td>"; echo "<td height=24 >$s[4]</td>"; } echo "</tr>"; ?> </body> </html> (编辑:汽车网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐