001.
<html>
002.
<head>
003.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
>
004.
<title>ThaiCreate.Com ListMenu</title>
005.
<script language =
"JavaScript"
>
006.
007.
008.
function
ListA(SelectValue)
009.
{
010.
frmMain.ddlProvince.length = 0
011.
frmMain.ddlAmphur.length = 0
012.
013.
014.
var
myOption =
new
Option(
''
,
''
)
015.
frmMain.ddlProvince.options[frmMain.ddlProvince.length]= myOption
016.
017.
<?
018.
$intRows
= 0;
019.
$strSQL
=
"SELECT * FROM ampher ORDER BY amph_id ASC "
;
020.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
021.
$intRows
= 0;
022.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
023.
{
024.
$intRows
++;
025.
?>
026.
x = <?=
$intRows
;?>;
027.
mySubList =
new
Array();
028.
029.
strGroup = <?=
$objResult
[
"province_id"
];?>;
030.
strValue =
"<?=$objResult["
amph_code
"];?>"
;
031.
strItem =
"<?=$objResult["
amph_name_th
"];?>"
;
032.
mySubList[x,0] = strItem;
033.
mySubList[x,1] = strGroup;
034.
mySubList[x,2] = strValue;
035.
if
(mySubList[x,1] == SelectValue){
036.
var
myOption =
new
Option(mySubList[x,0], mySubList[x,2])
037.
frmMain.ddlProvince.options[frmMain.ddlProvince.length]= myOption
038.
}
039.
<?
040.
}
041.
?>
042.
}
043.
044.
045.
046.
047.
function
ListT(SelectValue)
048.
{
049.
frmMain.ddlAmphur.length = 0
050.
051.
052.
var
myOption =
new
Option(
''
,
''
)
053.
frmMain.ddlAmphur.options[frmMain.ddlAmphur.length]= myOption
054.
055.
<?
056.
$intRows
= 0;
057.
$strSQL
=
"SELECT * FROM tambon ORDER BY tambon_id ASC "
;
058.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
059.
$intRows
= 0;
060.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
061.
{
062.
$intRows
++;
063.
?>
064.
x = <?=
$intRows
;?>;
065.
mySubList =
new
Array();
066.
067.
strGroup = <?=
$objResult
[
"amph_code"
];?>;
068.
strValue =
"<?=$objResult["
tambon_code
"];?>"
;
069.
strItem =
"<?=$objResult["
tambon_name_th
"];?>"
;
070.
mySubList[x,0] = strItem;
071.
mySubList[x,1] = strGroup;
072.
mySubList[x,2] = strValue;
073.
074.
if
(mySubList[x,1] == SelectValue){
075.
var
myOption =
new
Option(mySubList[x,0], mySubList[x,2])
076.
frmMain.ddlAmphur.options[frmMain.ddlAmphur.length]= myOption
077.
}
078.
<?
079.
}
080.
?>
081.
}
082.
083.
084.
</script>
085.
</head>
086.
<form name=
"frmMain"
action=
""
method=
"post"
>
087.
<p> </p>
088.
<table width=
"1175"
border=
"0"
>
089.
<tr>
090.
<td width=
"1169"
> </td>
091.
</tr>
092.
<tr>
093.
<td> </td>
094.
</tr>
095.
<tr>
096.
<td><table width=
"1165"
border=
"1"
bordercolor=
"#0000FF"
>
097.
<tr>
098.
<td width=
"200"
bordercolor=
"#FFFFFF"
><p><strong>จังหวัด
099.
<select id=
"ddlGeo"
name=
"ddlGeo"
style=
"width:120px"
onChange =
"ListA(this.value)"
>
100.
<option value=
""
>ทั้งหมด</option>
101.
<?
102.
$strSQL
=
"SELECT * FROM province WHERE province_id IN (22, 35, 55, 99) ORDER BY province_id ASC "
;
103.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
104.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
105.
{
106.
?>
107.
<option value=
"<?=$objResult["
province_id
"];?>"
>
108.
<?=
$objResult
[
"province_th"
];?>
109.
</option>
110.
<?
111.
}
112.
?>
113.
</select>
114.
</strong></p>
115.
<p><strong>อำเภอ
116.
<select id=
"ddlProvince"
name=
"ddlProvince"
style=
"width:120px"
onChange =
"ListT(this.value)"
>
117.
<option>ทั้งหมด</option>
118.
</select>
119.
</strong></p>
120.
<p><strong> ตำบล
121.
<select id=
"ddlAmphur"
name=
"ddlAmphur"
style=
"width:120px"
>
122.
<option>ทั้งหมด</option>
123.
</select>
124.
</strong></p> </td>
125.
<td width=
"949"
><table width=
"900"
border=
"1"
>
126.
<tr>
127.
<td width=
"73"
><div align=
"center"
><strong>เลขที่</strong></div></td>
128.
<td width=
"693"
><div align=
"center"
><strong>ชื่อเรื่องวิจัย</strong></div></td>
129.
<td width=
"120"
><div align=
"center"
><strong>หน่วยงาน</strong></div></td>
130.
</tr>
131.
<?php
do
{ ?>
132.
<tr>
133.
<td><?php
echo
$row_Recordset2
[
'Rsno'
]; ?></td>
134.
<td><?php
echo
$row_Recordset2
[
'Titlet'
]; ?></td>
135.
<td><?php
echo
$row_Recordset2
[
'Unit'
]; ?></td>
136.
</tr>
137.
<?php }
while
(
$row_Recordset2
= mysql_fetch_assoc(
$Recordset2
)); ?>
138.
<tr>
139.
<td> </td>
140.
<td> </td>
141.
<td> </td>
142.
</tr>
143.
</table></td>
144.
</tr>
145.
</table></td>
146.
</tr>
147.
</table>
148.
<p> </p>
149.
<p> </p>
150.
</form>
151.
</body>
152.
</html>