<?php require_once('connection/connect.php'); ?>S <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script language = "JavaScript"> function ListDepartment(SelectValue) { form1.department.length = 0 //*** Insert null Default Value ***// var myOption = new Option('','') form1.department.options[form1.department.length]= myOption <? $intRows = 0; $sql = "SELECT * FROM chapters ORDER BY chapterId ASC "; $result = mysql_query($sql) or die ("Error Query [".$sql."]"); $intRows = 0; while($row = mysql_fetch_array($result)) { $intRows++; ?> x = <?=$intRows;?>; mySubList = new Array(); strGroup = <?=$row["courseId"];?>; strValue = "<?=$row["chapterId"];?>"; strItem = "<?=$row["chapterName"];?>"; mySubList[x,0] = strItem; mySubList[x,1] = strGroup; mySubList[x,2] = strValue; if (mySubList[x,1] == SelectValue){ var myOption = new Option(mySubList[x,0], mySubList[x,2]) form1.department.options[form1.department.length]= myOption } <? } ?> } </script> </head> <body> <form name="form1" method="post" action=""> <select id="faculty" name="faculty" onChange = "ListDepartment(this.value)"> <option selected value="">Select</option> <? $sql = "SELECT * FROM courses ORDER BY courseId ASC "; $result = mysql_query($sql) or die ("Error Query [".$sql."]"); while($row = mysql_fetch_array($result)) { ?> <option value="<?=$row["courseId"];?>"><?=$row["courseName"];?></option> <? } ?> </select> <select id="department" name="department"> <option>Select</option> </select> </form> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง