php學生管理系統原始碼,供大家參考,具體內容如下
功能:
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) {
window.location="action.php?action=del&id="+id;
}
</script>
</head>
<body>
<center>
<?php
include ("menu.php");
?>
<h3>瀏覽學生資訊</h3>
<table width="500" border="1">
<tr>
<th>ID</th>
<th>姓名</th>
<th>性別</th>
<th>年齡</th>
<th>班級</th>
<th>操作</th>
</tr>
// 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"]}
php學生管理系統原始碼,供大家參考,具體內容如下
功能:
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) {
window.location="action.php?action=del&id="+id;
}
}
</script>
</head>
<body>
<center>
<?php
include ("menu.php");
?>
<h3>瀏覽學生資訊</h3>
<table width="500" border="1">
<tr>
<th>ID</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"]}