本文目錄一覽:
- 1、php 學生信息管理系統 修改怎麼寫
- 2、PHP怎麼做學生數據管理系統
- 3、如何用php代碼實現一個學生管理系統包括學生管理課程管理
- 4、我要用PHP做一個學生信息管理系統類似教務在線 需要學習哪些知識?
- 5、學生管理系統php源碼誰有
php 學生信息管理系統 修改怎麼寫
都是很簡單的東西,新手用得着、、、
省略部分前端代碼、、、
首先是登錄的校驗:
?php
session_start();
$user = $_POST[‘userName’];
$pass = $_POST[‘passWord’];
$_SESSION[‘user’] = $user;
/*$Enter = $_POST[‘Login_undo’];
管理員登錄的校驗*/
$flag = false;
if($user == “Admin” $pass == “root”)
{
setcookie(“userName”,$user,time()+1200);
setcookie(“userName”,$pass,time()+1200);
$flag = true;
header(‘location:adminPage.php?user=’ . $user);
}
else
header(‘location:Login.php?login=relog’);
/*
// 學生登錄免校驗
if($Enter)
header(‘location:StuPage.php’);
*/
然後是註冊的校驗:
?php
session_start();
$s_ID = $_POST[‘s_ID’];
$Name = $_POST[‘Name’];
$IDcard = $_POST[‘IDcard’];
$Major = $_POST[‘Major’];
$sex = $_POST[‘sex’];
$_SESSION[‘student’][$s_ID][‘s_ID’] = $s_ID;
$_SESSION[‘student’][$s_ID][‘Name’] = $Name;
$_SESSION[‘student’][$s_ID][‘IDcard’] = $IDcard;
$_SESSION[‘student’][$s_ID][‘Major’] = $Major;
$_SESSION[‘student’][$s_ID][‘sex’] = $sex;
header(‘location:tisi.html’);
/*foreach($_SESSION[‘student’] as $v)
{
if($v == $s_ID)
{
header(“location:stu_reg.php?action=lookmsg=更新user=employeeempno=” . $empno . “idcard=” . $idcard);
}
else
header(“location:stu_reg.php?action=lookmsg=增加user=employeeempno=” . $empno . “idcard=” . $idcard);
}*/
畢業操作及加入歷史校驗:
?php
session_start();
$s_ID=$_GET[‘s_ID’];
$_SESSION[‘history’][$s_ID][‘s_ID’]=$s_ID;
$_SESSION[‘history’][$s_ID][‘Name’]=$_SESSION[‘student’][$s_ID][‘Name’];
$_SESSION[‘history’][$s_ID][‘IDcard’]=$_SESSION[‘student’][$s_ID][‘IDcard’];
$_SESSION[‘history’][$s_ID][‘sex’]=$_SESSION[‘student’][$s_ID][‘sex’];
$_SESSION[‘history’][$s_ID][‘Major’]=$_SESSION[‘student’][$s_ID][‘Major’];
unset($_SESSION[‘student’][$s_ID]);
header(‘location:graduate.php?user=Adminaction=delete’);
任意關鍵詞查詢:
?php
session_start();
$search=$_POST[‘search’];
unset($_SESSION[‘search’]);
/*echo ‘pre’;
var_dump($_POST[‘search’]);
return ;*/
foreach ($_SESSION[‘student’] as $k1 = $value) {
# code…
if($search==$_SESSION[‘student’][$k1][‘s_ID’]||$search==$_SESSION[‘student’][$k1][‘IDcard’]||$search==$_SESSION[‘student’][$k1][‘Name’]||$search==$_SESSION[‘student’][$k1][‘sex’]||$search==$_SESSION[‘student’][$k1][‘Major’]){
$i = 1;
$stu = $_SESSION[‘student’][$k1][‘s_ID’];
$_SESSION[‘search’][$stu] = $stu;
}
}
if(isset($i))
header(“location:stu_Query.php?user=Adminaction=search”);
else
header(“location:stu_Query.php?user=Adminaction=q_error”);
遍歷學生信息:
!DOCTYPE HTML
html
head
link href=”file/Style.Css” rel=”stylesheet” type=”text/css” /
/head
body
table width=”100%” border=”0″ cellpadding=”1″ cellspacing=”1″ class=”css_table” bgcolor=’#E1E1E1′
?php
session_start();
$user = isset($_SESSION[‘user’])?$_SESSION[‘user’]:”;
if($user ==’Admin’){
if(isset($_SESSION[‘student’])){
foreach($_SESSION[‘student’] as $k1) {
echo “tr”;
foreach($k1 as $k2=$k3) {
echo “td” ;
if($k2==’s_ID’) {echo “學號:” ;} else if($k2==’IDcard’){echo “身份證號:”;}else if($k2==’sex’){echo “性別:”;}else if($k2==’Name’){echo “姓名:”;}else if($k2 ==’Major’){echo “專業:”;};
echo “/td”;
echo “td”;
if($k2==’s_ID’) $s_ID=$k3; echo “$k3”;
echo “/td”;
}
}
}
}
?
/table
/body
/html
更新數據的頁面及校驗:
!DOCTYPE HTML
!– 使用HTML5規範,省略多餘部分 —
html
head
?php
session_start();
$user = isset($_SESSION[‘user’])?$_SESSION[‘user’]:”;
$action = isset($_GET[‘action’])?$_GET[‘action’]:”;
?
link href=”file/Style.Css” rel=”stylesheet” type=”text/css” /
/head
body
?php if($user ==’Admin’$action==”){ ?
table width=”100%” border=”0″ cellpadding=”3″ cellspacing=”1″ class=”css_table” bgcolor=’#E1E1E1′
tr class=”css_menu”
td colspan=”3″
table width=”100%” border=”0″ cellpadding=”4″ cellspacing=”0″ class=”css_main_table”
tr
td class=”css_main”注意/td
/tr
/table
/td
/tr
tr
td class=”css_col11″strongfont color=#50691B一旦確定不可更改/font/strong/td
/tr
form name = “check_stu” method=”post” action=”check_stu.php”
tdlable請輸入修改學生的學號:
input name = “c_ID” type=”text”
input name = “submit” type=”submit” value=”確定”
/lable/td
/form
/table
?php }else if ($action == ‘change’) {?
form name=”login_f” method=”post” action=”update_check.php”
div class = “login” align=”center”
lable可以修改的項目:/lable
input name = “c_ID” type=”hidden” value = “?php echo $_GET[‘c_ID’];?”
lip學生姓名:
input name = “Name” type = “text” id = “Name”/p/li
lip專業:
input name = “Major” type = “text” id = “Major”/p/li
li
p性別:
!– input name = “sex” type = “text” id = “sex”/p/li —
input type=”radio” name=”sex” value=”男”/男
input type=”radio” name=”sex” value=”女”/女 /br
/li
lip確定修改:
input name = “submit” type = “submit” value = “確定”
input class=”Renew” value=”重寫” type=”reset” / /p/li
/form
/div
?php }else if ($action == ‘enchange’) {
# code…
echo “h1已經改變/h1”;
}?
/body
/html
?php
session_start();
$s_ID = $_POST[‘c_ID’];
$Name = $_POST[‘Name’];
$Major = $_POST[‘Major’];
$sex = $_POST[‘sex’];
$_SESSION[‘student’][$s_ID][‘s_ID’] = $s_ID;
$_SESSION[‘student’][$s_ID][‘Name’] = $Name;
$_SESSION[‘student’][$s_ID][‘Major’] = $Major;
$_SESSION[‘student’][$s_ID][‘sex’] = $sex;
header(“location:stu_Update.php?action=enchange”);
PHP怎麼做學生數據管理系統
下載MYSQL 安裝 創建數據庫
下載PHP環境 WAMP並安裝,下載編輯器例如sublime text,下載熟悉的php框架例如CI 將CI包解壓至wamp的www文件夾下,使用sublime text 打開文件夾,配置CI框架內的數據庫等信息,使用CI框架編寫程序;
如何用php代碼實現一個學生管理系統包括學生管理課程管理
這個不是一兩句話能說清楚的,也不清楚你現在水平在什麼位置。
不過我說一下,需要的技術和方法步驟。
首先,你要會html css 最好還會javascript
然後是php mysql
這五種最基本的技術。
然後:
1.先用html+css寫好你程序用到的網站界面。
2.設計數據庫,比如 學生表,課程表,班級表,教師表等等
3.用php寫後台,如登陸後台,之後就是對數據庫增刪改查。
我要用PHP做一個學生信息管理系統類似教務在線 需要學習哪些知識?
登陸的話你要學習表單知識,php驗證表單提交的數據,以及如何跟數據庫進行匹配,註冊的話也差不多,首先表單提交內容,php接收內容,最後一點不同的是註冊是要寫數據庫的。所以三個知識點你最起碼要懂。(表單 php接收數據 sql語言)這三個。;後台的話設計內容比較多,不過數據庫方面的到是不外乎 1、查詢 2、修改 3、刪除 4、新增 這4種sql語言,最後一點就是你要懂html代碼,因為這是學做網頁的基本
學生管理系統php源碼誰有
php學生管理系統源碼,供大家參考,具體內容如下
功能:
1.添加/刪除/修改
2.數據存儲.
界面分布:
index.php
—主界面
add.php —stu添加
action — sql中add/del/update
(處理html表單–mysql的數據存儲 && 頁面跳轉)
edit.php —stu修改
menu.php
–首頁
1. index.php
!DOCTYPE html
html lang=”en”
head
meta charset=”UTF-8″
title學生信息管理/title
script
function doDel(id) {
if(confirm(‘確認刪除?’)) {
window.location=’action.php?action=delid=’+id;
}
}
/script
/head
body
center
?php
include (“menu.php”);
?
h3瀏覽學生信息/h3
table width=”500″ border=”1″
tr
thID/th
th姓名/th
th性別/th
th年齡/th
th班級/th
th操作/th
/tr
?php
// 1. 鏈接數據庫
try{
$pdo = new PDO(“uri:mysqlPdo.ini”,”root”,”1″);
}catch (PDOException $e) {
die(‘connection failed’.$e-getMessage());
}
//2.執行sql
$sql_select = “select * from stu”;
//3.data 解析
foreach ( $pdo-query($sql_select) as $row) {
echo “tr”;
echo “th{$row[‘id’]} /th”;
echo “th{$row[‘name’]}/th”;
echo “th{$row[‘sex’]} /th”;
echo “th{$row[‘age’]} /th”;
echo “th{$row[‘classid’]}/th”;
echo “td
a href=’edit.php?id={$row[‘id’]}’修改/a
a href=’javascript:void(0);’ onclick=’doDel({$row[‘id’]})’刪除/a
/td”;
echo “/tr”;
}
?
/table
/center
/body
/html
2. add.php
!DOCTYPE html
html lang=”en”
head
meta charset=”UTF-8″
title學生管理系統/title
/head
body
center
?php include (‘menu.php’); ?
h3增加學生信息/h3
form action=”action.php?action=add” method=”post”
table
tr
td姓名/td
tdinput type=”text” name=”name”/td
/tr
tr
td年齡/td
tdinput type=”text” name=”age”/td
/tr
tr
td性別/td
tdinput type=”radio” name=”sex” value=”男”男/td
tdinput type=”radio” name=”sex” value=”女”女/td
/tr
tr
td班級/td
tdinput type=”text” name=”classid”/td
/tr
tr
!– td /td–
tda href=”index.php”返回/td
tdinput type=”submit” value=”添加”/td
tdinput type=”reset” value=”重置”/td
/tr
/table
/form
/center
/body
/html
3. action.php
?php
/**
* Created by PhpStorm.
* User: hyh
* Date: 16-7-7
* Time: 下午9:37
*/
//1. 鏈接數據庫
try{
$pdo = new PDO(“uri:mysqlPdo.ini”,”root”,”1″);
}catch (PDOException $e) {
// echo ‘Connection failed: ‘ . $e-getMessage();
die(‘connection failed’.$e-getMessage());
}
//2.action 的值做對操作
switch ($_GET[‘action’]){
case ‘add’://add
$name = $_POST[‘name’];
$sex = $_POST[‘sex’];
$age = $_POST[‘age’];
$classid = $_POST[‘classid’];
$sql = “insert into stu (name, sex, age, classid) values (‘{$name}’, ‘{$sex}’,'{$age}’,'{$classid}’)”;
$rw = $pdo-exec($sql);
if ($rw 0){
echo “scriptalter(‘添加成功’);/script”;
}else{
echo “scriptalter(‘添加失敗’);/script”;
}
header(‘Location: index.php’);
break;
case ‘del’://get
$id = $_GET[‘id’];
$sql = “delete from stu where id={$id}”;
$rw = $pdo-exec($sql);
if ($rw 0){
echo “scriptalter(‘刪除成功’);/script”;
}else{
echo “scriptalter(‘刪除失敗’);/script”;
}
header(‘Location: index.php’);
break;
case ‘edit’://post
$id = $_POST[‘id’];
$name = $_POST[‘name’];
$age = $_POST[‘age’];
$classid = $_POST[‘classid’];
$sex = $_POST[‘sex’];
// echo $id, $age, $age, $name;
$sql = “update stu set name='{$name}’, age={$age},sex='{$sex}’,classid={$classid} where id={$id};”;
// $sql = “update myapp.stu set name=’jike’,sex=’女’, age=24,classid=44 where id=17”;
print $sql;
$rw = $pdo-exec($sql);
if ($rw 0){
echo “scriptalter(‘更新成功’);/script”;
}else{
echo “scriptalter(‘更新失敗’);/script”;
}
header(‘Location: index.php’);
break;
default:
header(‘Location: index.php’);
break;
}
4.edit.php
!DOCTYPE html
html lang=”en”
head
meta charset=”UTF-8″
title學生管理系統/title
/head
body
center
?php include (‘menu.php’);
//1. 鏈接數據庫
try{
$pdo = new PDO(“uri:mysqlPdo.ini”,”root”,”1″);
}catch (PDOException $e) {
die(‘connection failed’.$e-getMessage());
}
//2.執行sql
$sql_select = “select * from stu where id={$_GET[‘id’]}”;
$stmt = $pdo-query($sql_select);
if ($stmt-rowCount() 0) {
$stu = $stmt-fetch(PDO::FETCH_ASSOC); // 解析數據
}else{
die(“no have this id:{$_GET[‘id’]}”);
}
?
h3修改學生信息/h3
form action=”action.php?action=edit” method=”post”
input type=”hidden” name=”id” value=”?php echo $stu[‘id’];?”
table
tr
td姓名/td
tdinput type=”text” name=”name” value=”?php echo $stu[‘name’];?”/td
/tr
tr
td年齡/td
tdinput type=”text” name=”age” value=”?php echo $stu[‘age’];?”/td
/tr
tr
td性別/td
td
input type=”radio” name=”sex” value=”男” ?php echo ($stu[‘sex’] == “男”)? “checked”:””;? 男
/td
td
input type=”radio” name=”sex” value=”女” ?php echo ($stu[‘sex’] == “女”)? “checked”:””;? 女
/td
/tr
tr
td班級/td
tdinput type=”text” name=”classid” value=”?php echo $stu[‘classid’]?”/td
/tr
tr
td /td
tdinput type=”submit” value=”更新”/td
tdinput type=”reset” value=”重置”/td
/tr
/table
/form
/center
?php
?
/body
/html
5. menu.php
!DOCTYPE html
html lang=”en”
body
h2學生管理系統/h2
a href=”index.php” 瀏覽學生/a
a href=”add.php” 添加學生/a
hr
/body
/html
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-hant/n/286636.html