[問題] 有關cookie的問題

看板Ajax作者 (伯伯)時間17年前 (2008/01/03 15:14), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
有關COOKIE的問題要懇請幫忙.. 就是我有一個A網站:http://meeter1.ath.cx/selectmbrs.php 當我點選「人」時他會回傳值到上方的textarea 但是當我換部門點選時時,之前上方所選取的人都會不見.. 請問是不是要用cookie來解決? 如果是該如何做呢? 這是A網站的CODE: <?php require './unempty.php'; require './config.php'; cnnt2db(); $dept = $_GET['dept']; if(strlen($dept)==0){ $dept = $_SESSION['ssndepartment']; } //往上找嫡系部門ID,Name function showupdept($dept){ cnnt2db(); $sql = "select `GroupName` from `Group` where `GroupNo` = '$dept'"; $result=mysql_query($sql); $row=mysql_fetch_row($result); $alldept[0] = $dept; $alldept[1] = $row[0]; $pdept = dep_p($dept); $i = 2; while($pdept != "root"){ $sql = "select `GroupName` from `Group` where `GroupNo` = '$pdept'"; $result=mysql_query($sql); $row=mysql_fetch_row($result); $alldept[$i++] = $pdept; $alldept[$i++] = $row[0]; $pdept = dep_p($pdept); } mysql_close(); return $alldept; } //找子部門ID,Name function showdowndept($dept){ $cdep = explode(",", dep_c($dept)); cnnt2db(); $j = 0; for ($i=0; $i<sizeof($cdep) ;$i++){ $sql = "select `GroupName` from `Group` where `GroupNo` = '$cdep[$i]'"; $result=mysql_query($sql); $row=mysql_fetch_row($result); $alldept[$j++] = $cdep[$i]; $alldept[$j++] = $row[0]; } mysql_close(); return $alldept; } //找部門內員工ID,Name function showdeptmembers($dept){ cnnt2db(); $sql = "select `UserNO`,`UserName` from `Users` where `Department` = '$dept'"; $result=mysql_query($sql); $i=0; while($row = mysql_fetch_row($result)){ $members[$i++]=$row[0]; $members[$i++]=$row[1]; } mysql_close(); return $members; } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>選取會議成員 </title> <script language="JavaScript"> function monther_change() { opener.document.forms["meeting"].member.value += document.forms["selection_form"].member.value ; self.close; } function myadd(adds) { document.forms["selection_form"].member.value += adds ; document.forms["selection_form"].member.value += "," ; } </script> </head> <body bgcolor=#CCFFCC> <form name="selection_form" id="selection_form"> <font color="#DD9999" size="5">請點選會議人員:</font><br> <textarea name="member" id="member" rows=4 cols=50 ></textarea> </form> <input type="button" value="確定" onclick="monther_change();self.close();"><p> <table > <tr> <?php $updept = showupdept($dept); $i = sizeof($updept); echo "<th align=\"left\" colspan=\"6\">目前所在部門:"; while($i > 0){ echo "<a href=?dept=".$updept[$i-2].">".$updept[$i-1]."</a>&gt;"; $i-=2; } echo "</th></tr>"; $downdept = showdowndept($dept); $i = $j = 0; if(sizeof($downdept)>2){ while($i < sizeof($downdept)){ $tb[$j++] = "<a href=?dept=".$downdept[$i].">".$downdept[$i+1]."</a>"; $i+=2; } } $deptmembers = showdeptmembers($dept); $i=0; while($i < sizeof($deptmembers)){ $tb[$j++] = "<font color='blue'><U><a onclick = \"myadd('".$deptmembers[$i]."(".$deptmembers[$i+1].")"."')\">".$deptmembers[$i+1]."</a></U></font>"; $i+=2; } //Print_r($tb); for($i = 0 ; $i < $j ; $i++ ){ if($i%6==5){ echo "<td>$tb[$i]</td></tr><tr>"; }else{ echo "<td>$tb[$i]</td>"; } } ?> </tr> </table> </body> </html> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.68.235.43
文章代碼(AID): #17V8jfjK (Ajax)
文章代碼(AID): #17V8jfjK (Ajax)