php學(xué)生管理系統(tǒng)源碼,供大家參考,具體內(nèi)容如下
功能:
1.添加/刪除/修改
2.數(shù)據(jù)存儲(chǔ).
界面分布:
index.php
--->主界面
add.php --->stu添加
action ---> sql中add/del/update
(處理html表單-->mysql的數(shù)據(jù)存儲(chǔ) && 頁面跳轉(zhuǎn))
edit.php --->stu修改
menu.php
-->首頁
1. index.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>學(xué)生信息管理</title>
<script>
function doDel(id) {
if(confirm('確認(rèn)刪除?')) {
window.location='action.php?action=del&id='+id;
}
}
</script>
</head>
<body>
<center>
<?php
include ("menu.php");
?>
<h3>瀏覽學(xué)生信息</h3>
<table width="500" border="1">
<tr>
<th>ID</th>
<th>姓名</th>
<th>性別</th>
<th>年齡</th>
<th>班級(jí)</th>
<th>操作</th>
</tr>
<?php
// 1. 鏈接數(shù)據(jù)庫
try{
$pdo = new PDO("uri:mysqlPdo.ini","root","1");
}catch (PDOException $e) {
die('connection failed'.$e->getMessage());
}
//2.執(zhí)行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']}