function Showbrand(SelectValue) { frmMain.ddlShowbrand.length = 0 var myOption = new Option('--ดูรถทุกประเภท--','0') frmMain.ddlShowbrand.options[frmMain.ddlShowbrand.length]= myOption <? $intRows = 0; $strSQL = "SELECT * FROM car_type WHERE type_level = '2'"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $intRows = 0; while($objResult = mysql_fetch_array($objQuery)) { $intRows++; ?> x = <?=$intRows;?>; mySubList = new Array(); strGroup = <?=$objResult["type_id"];?>; strValue = "<?=$objResult["type_level"];?>"; strItem = "<?=$objResult["type_name"];?>"; 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]) frmMain.ddlShowbrand.options[frmMain.ddlShowbrand.length]= myOption } <? } ?> } </script> <img src="img/labelsearch.png" width="160" style="padding-top:15px;"/> <form id="form2" action="car_search.php" method="post"> <div> <label>ประเภทของรถ</label> <select name="users" onChange="Showbrand(this.value)" style="width:160px;"> <option value="0">-- ดูรถทุกประเภท --</option> <? $strSQL = mysql_query("SELECT * FROM car_type WHERE type_level = '1'"); while($rs = mysql_fetch_array($strSQL)) { ?> <option value="<?=$rs['type_id'];?>"><?=$rs['type_name'];?></option> <? } ?> </select> </div> <div> <label>ยี่ห้อรถ</label> <select id="ddlShowbrand" name="ddlShowbrand" style="width:160px;"> <option value="0">-- ดูรถทุกยี่ห้อ --</option> </select> </div>
Quote:strGroup = <?=$objResult["type_id"];?>;
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง