这是我的代码,运行结果如图。如何显示出数据库信息并可以修改某一项。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<title>学生信息</title>
</head>
<body>
<?php
//######################学生信息##########################
include "config.php";
include "header.php";
?>
<?php
extract($_POST);
if ($xuehao=="" ||$password=="")
{
echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>请把信息填写完整</big></b></font></p>";
echo "<meta http-equiv=\"refresh\" content=\"1;url=query3.php\">";
exit;
}
else
{
$query="select * from $student_table where xuehao='$xuehao'";
mysql_query("set names 'GB2312'");
$result=mysql_query($query);
$row=mysql_fetch_array($result);
if($row==0)
{
echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>你还没有注册,请先注册。</big></b></font></p>";
echo "<meta http-equiv=\"refresh\" content=\"1;url=student_register.php\">";
exit;
}
$query="select password as sm from $student_table where xuehao='$xuehao'";
mysql_query("set names 'GB2312'");
$result=mysql_query($query);
$row=mysql_fetch_array($result);
$num=strlen($row['xuehao']);
$xh=$row['xuehao'];
$n=0;
if($row[sm]!=$password)
{
echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>你输入的学号和密码不匹配,请重新输入。</big></b></font></p>";
echo "<meta http-equiv=\"refresh\" content=\"2;url=query3.php\">";
exit;
}
}
?>
<p>
</p>
<table width="600" border="1" align="center" cellpadding="0" cellspacing="1" class="text">
<!--DWLayoutTable-->
<form name="form1" method="post" action="student_information.php">
<tr bgcolor="#E4E4E4">
<td height="27" colspan="3"><span class="STYLE1">>>>学生信息</span></td>
</tr>
<tr>
<td width="148" bgcolor="#FFFFFF"><div align="center" class="STYLE2">
<div align="right" class="STYLE4">学号:</div>
</div></td>
<td width="443" bgcolor="#FFFFFF" height="39"> <input type="text" name="xuehao" size="25" value="<?php echo $row['xuehao'] ?>" readonly="readonly">
</td>
</tr>
<tr>
<td width="148" bgcolor="#E4E4E4"><div align="center" class="STYLE4">
<div align="right">姓名:</div>