<html>
<head>
<title>查詢</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
</head>
<table>
<body>
<h2 align="center">查詢資料</h2>
<font color="red">請輸入欲查詢資料</font>
<form action="update1.php" method="POST">
E_code:<input type="text" name="E_code">
<input type="submit" value="查詢">
</form>
<?php
$E_code=$_POST['E_code'];
$E_name=$_POST['E_name'];
$E_sex=$_POST['E_sex'];
$E_age=$_POST['E_age'];
$E_birthday=$_POST['E_birthday'];
$E_address=$_POST['E_address'];
$E_business=$_POST['E_business'];
if(isset($E_code)){
$link=mysql_connect("localhost","root","");
mysql_select_db("Hospital");
mysql_query("set character set big5");
$check=mysql_query("select * from employee where E_code='$E_code'");
$sum=mysql_num_rows($check);
if($sum==0){
echo "sorry,查詢不到你要修改的資料!!";
exit;
?>
<?php
}else{
$str="update employee set E_name='$E_name',E_sex='$E_sex',E_age='$E_age',E_birthday='$E_birthday',E_address='$E_address',E_business='$E_business' where E_code='$E_code'";
//echo $str;
mysql_query($str);
?>
<?php
$result=mysql_query("select * from employee where E_code='$E_code'");
while(list($E_no,$E_code,$E_name,$E_sex,$E_age,$E_birthday,$E_address,$E_business)=mysql_fetch_row($result))
{
?>
<hr>
<h2 align="center"> 修改資料區 </h2>
<font color="red">修改--在下面欄位輸入要修改的資料 </font>
<form action="update1.php" method="POST">
/*<p>"E_code:".$E_code</p>;*/
<p>"E_name:"<input type="text" name="E_name" value="$_POST['E_name']"></p>
<p>"E_sex:"<input type="text" name="E_sex" value="$E_sex"></p>
<p>"E_age:"<input type="text" name="E_age" value="$E_age"></p>
<p>"E_birthday:"<input type="text" name="E_birthday" value="$E_birthday"></p>
<p>"E_address:"<input type="text" name="E_address" value="$E_address"></p>
<p>"E_business:"<input type="text" name="E_business" value="$E_business"></p>
<?php
}
?>
<p><input type="submit" name="submit" value="更新">
</form>
<?php
}mysql_close($link);
}
?>
</table>
</body>
</html>
=======================================
好心人幫幫我~~為什麼我的資料出現不了在欄位上呢?一直出不來

糾察與勸告:
發表文章請使用"明確"主題