<?php
$link = mysql_connect("localhost","root","123456") or die("無法連接資料庫");
@mysql_select_db("school")or die("無法選擇資料庫");
mysql_query("SET NAMES 'utf8'");
$sql = "select * from student where sid='$stid'";
$result = mysql_query($sql);
if(mysql_num_rows($result)==0){
echo "找不到資料";
} else {
$row=mysql_fetch_array($result);
echo "<form action=stupdate.php method=post name=myform>";
echo "<p>";
echo "學號:<input name=stid type=text value=$row[sid] readonly></p>";
echo "<p>";
echo "班級:<input name=stclass type=text value=$row[sclass]></p>";
echo "<p>";
echo "姓名:<input name=stname type=text value=$row[sname]></p>";
echo "<input name=key type=submit value=修改 /><input name=key type=reset value=重設 /></p>";
echo "</form>";
}
?>