昱得資訊工作室
麻辣學園
歡迎光臨, 訪客. 請先 登入註冊一個帳號.
您忘了 啟用您的帳號嗎?
2008-07-24, 16:16:51
首頁 說明 登入 註冊 贊助論壇 想當作者?
新聞: 為增進論壇品質,全面更新硬體設備,經費有限,請各位踴躍贊助論壇!!


+  麻辣家族討論區
|-+  網頁設計
| |-+  PHP
| | |-+  求救!!!
0 會員 以及 1 訪客 正在閱讀本篇主題. « 上一篇主題 下一篇主題 »
頁: [1] 向下 列印
作者 主題: 求救!!!  (閱讀 968 次)
我也很想他
中學生
*
離線 離線

文章: 27


求救!!!
« 於: 2005-04-30, 22:47:28 »

<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)){
&nbsp; &nbsp; &nbsp; &nbsp;$link=mysql_connect("localhost","root","");
&nbsp; &nbsp; &nbsp; &nbsp;mysql_select_db("Hospital");
&nbsp; &nbsp; &nbsp; &nbsp;mysql_query("set character set big5");
&nbsp; &nbsp; &nbsp; &nbsp;$check=mysql_query("select * from employee where E_code='$E_code'");
&nbsp; &nbsp; &nbsp; &nbsp;$sum=mysql_num_rows($check);
&nbsp; &nbsp; if($sum==0){
&nbsp; &nbsp;   &nbsp; echo "sorry,查詢不到你要修改的資料!!";
&nbsp; &nbsp;   &nbsp; exit;&nbsp; &nbsp;
 ?>&nbsp; &nbsp;
&nbsp; &nbsp;
 <?php
&nbsp; &nbsp; &nbsp;}else{
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$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'";
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//echo $str;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mysql_query($str);
 ?>
&nbsp;
&nbsp; <?php
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$result=mysql_query("select * from employee where E_code='$E_code'");
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;while(list($E_no,$E_code,$E_name,$E_sex,$E_age,$E_birthday,$E_address,$E_business)=mysql_fetch_row($result))
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
&nbsp; ?>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<hr>
&nbsp; &nbsp;    &nbsp; &nbsp; &nbsp;<h2 align="center"> 修改資料區 </h2>
&nbsp; &nbsp;    &nbsp; &nbsp; &nbsp;<font color="red">修改--在下面欄位輸入要修改的資料 </font>
&nbsp; &nbsp;    &nbsp; &nbsp; &nbsp;


&nbsp; &nbsp;    &nbsp; &nbsp; &nbsp;<form action="update1.php" method="POST">
&nbsp; &nbsp;    &nbsp; &nbsp; &nbsp;/*<p>"E_code:".$E_code</p>;*/
&nbsp; &nbsp;    &nbsp; &nbsp; &nbsp;<p>"E_name:"<input type="text" name="E_name" value="$_POST['E_name']"></p>
&nbsp; &nbsp;    &nbsp; &nbsp; &nbsp;<p>"E_sex:"<input type="text" name="E_sex" value="$E_sex"></p>
&nbsp; &nbsp;    &nbsp; &nbsp; &nbsp;<p>"E_age:"<input type="text" name="E_age" value="$E_age"></p>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<p>"E_birthday:"<input type="text" name="E_birthday" value="$E_birthday"></p>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<p>"E_address:"<input type="text" name="E_address" value="$E_address"></p>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<p>"E_business:"<input type="text" name="E_business" value="$E_business"></p>
&nbsp; &nbsp;<?php
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
&nbsp; &nbsp;?>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<p><input type="submit" name="submit" value="更新">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</form>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 <?php
&nbsp; &nbsp; &nbsp; }mysql_close($link);&nbsp; &nbsp; &nbsp;
}
 ?>
 
</table>
</body>
</html>
=======================================
好心人幫幫我~~為什麼我的資料出現不了在欄位上呢?一直出不來
糾察與勸告:
發表文章請使用"明確"主題
« 最後編輯時間: 2005-05-01, 00:30:21 由 小誌 » 已記錄
小誌
論壇管理員
*
離線 離線

會員性別: 男
文章: 589



個人網站
Re: 求救!!!
« 回覆文章 #1 於: 2005-05-01, 00:32:32 »

看到你的文章主題真令人有點不願意伸出援手

以性別欄位為例應該這樣寫
程式碼:
<input type="text" name="E_sex" value="<?=$E_sex?>">
已記錄

為了論壇的永續經營,您不妨
贊 助 論 壇
我也很想他
中學生
*
離線 離線

文章: 27


Re: 求救!!!
« 回覆文章 #2 於: 2005-05-01, 01:16:17 »

不好意思喔~

貼的時候沒有注意~

下次我會注意一下~

sorry~
已記錄
頁: [1] 向上 列印 
« 上一篇主題 下一篇主題 »
跳到:  


本頁花了 0.16 秒, 以及 20 次的資料庫查詢.