<?php include("../db_conn.inc.php"); ?> <!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=utf-8" /> <title>Untitled Document</title> <link href="style/style.css" rel="stylesheet" type="text/css"> <script language="javascript"> //ClassName (start) function ListClass(value) { formSearch.selClass.length = 0; //formSearch.selTerm.length = 0; //insert null default value var myOption = new Option('',''); formSearch.selClass.options[formSearch.selClass.length]=myOption; <?php $sql = "select * from dbo_tbreportscheduleclass order by ClassID asc ;"; $query = mysql_query($sql)or die(mysql_error()); $intRows = 0; while($result = mysql_fetch_array($query)) { $intRows++; ?> x = <?=$intRows;?>; mySubList = new Array(); strGroup = <?=$result["GroupsName"];?>;//SelGroup strValue = <?=$result["ClassID"];?>; strItem = <?=$result["ClassName"];?>; mySubList[x,0]=strItem; mySubList[x,1]=strGroup; mySubList[x,2]=strValue; if(mySubList[x,1] == value) { var myOption = new Option(mySubList[x,0], mySubList[x,2]); formSearch.selClass.options[formSearch.selClass.length]=myOption; } <?php } ?> } </script> </head> <body> <h3 align="center">ค้นหาตารางเรียน</h3> <form id="formSearch" name="formSearch" class="cssform1" method="post" action=""> <p><label for="selGroup">กลุ่มเรียน : </label> <select name="selGroup" id="selGroup" onchange="ListClass(this.value)"> <option selected="selected" value="">-----โปรดเลือก-----</option> <?php $sql = "select distinct(GroupsName) from dbo_tbreportscheduleclass order by GroupsName asc;"; $query = mysql_query($sql)or die(mysql_error()); while($result = mysql_fetch_assoc($query)) { ?> <option value="<?=$result["GroupsName"];?>"><?=$result["GroupsName"];?></option> <?php } ?> </select> </p> <p> <label for="selClass">ห้องเรียน : </label> <select name="selClass" id="selClass"> </select> </p> </form> </body> </html>
Quote: strGroup = <?=$result["GroupsName"];?>;//SelGroup strValue = <?=$result["ClassID"];?>; strItem = <?=$result["ClassName"];?>;
strGroup = "<?=$result["GroupsName"];?>";//SelGroup strValue = "<?=$result["ClassID"];?>"; strItem = "<?=$result["ClassName"];?>";
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง