001.
<?PHP
002.
003.
004.
include
"config.php"
;
005.
$objConnect
=mysql_connect(
$host
,
$user
,
$pw
)
or
die
(
"ติดต่อ Host ไม่ได้"
);
006.
$objDB
= mysql_select_db(
$dbname
)
or
die
(
"ติดต่อฐานข้อมูลไม่ได้"
);
007.
008.
@mysql_query(
"SET character_set_results=tis620"
);
009.
@mysql_query(
"SET character_set_client='tis620'"
);
010.
@mysql_query(
"SET character_set_connection='tis620'"
);
011.
@mysql_query(
"collation_connection = tis620_thai_ci"
);
012.
@mysql_query(
"collation_database = tis620_thai_ci"
);
013.
@mysql_query(
"collation_server = tis620_thai_ci"
);
014.
?>
015.
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN"
>
016.
<HTML><HEAD><TITLE></TITLE>
017.
<META content=
"text/html; charset=windows-874"
http-equiv=Content-Type>
018.
<link rel=
"stylesheet"
type=
"text/css"
href=
"epoch_styles.css"
/>
019.
<script type=
"text/javascript"
src=
"epoch_classes.js"
></script>
020.
<script src=
"prototype.js"
language=
"javascript"
type=
"text/javascript"
></script>
021.
<?php
022.
require
(
"mod_ctrl_autocompletejs.php"
);
023.
?>
024.
<script type=
"text/javascript"
>
025.
var
bas_cal,dp_cal,ms_cal;
026.
window.onload =
function
() {
027.
dp_cal =
new
Epoch(
'epoch_popup'
,
'popup'
,document.getElementById(
'tdate'
));
028.
};
029.
</script>
030.
<META name=GENERATOR content=
"MSHTML 8.00.6001.18812"
>
031.
<SCRIPT LANGUAGE=
"JavaScript"
>
032.
function
Start(page)
033.
{
034.
OpenWin = this.open(page,
"CtrlWindow"
,
"toolbar=No,menubar=No,location=No,scrollbars=Yes,resizable=Yes,status=No,width=600,height=450,top=200,left=450"
);
035.
}
036.
037.
</SCRIPT>
038.
<script language=
"JavaScript"
type=
"text/JavaScript"
>
039.
function
Checkdata(){
040.
if
(document.formAddThesis.ddldegree.value ==
""
){
041.
alert(
'กรุณาเลือกระดับ'
);
042.
document.formAddThesis.ddldegree.focus();
043.
return
false;
044.
}
045.
if
(document.formAddThesis.ddlcurr.value ==
""
){
046.
alert(
'กรุณาเลือกหลักสูตร'
);
047.
document.formAddThesis.ddlcurr.focus();
048.
return
false;
049.
}
050.
if
(document.formAddThesis.ddlmajor.value ==
""
){
051.
alert(
'กรุณาเลือกสาขาวิชา'
);
052.
document.formAddThesis.ddlmajor.focus();
053.
return
false;
054.
}
055.
}
056.
</script>
057.
<script language =
"JavaScript"
>
058.
059.
060.
function
Listcurr(SelectValue)
061.
{
062.
formAddThesis.ddlcurr.length = 0
063.
formAddThesis.ddlmajor.length = 0
064.
065.
var
myOption =
new
Option(
''
,
''
)
066.
formAddThesis.ddlcurr.options[formAddThesis.ddlcurr.length]= myOption
067.
<?
068.
$intRows
= 0;
069.
$strSQL
=
"SELECT * FROM tb_curr ORDER BY curr_id ASC "
;
070.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
071.
$intRows
= 0;
072.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
073.
{
074.
$intRows
++;
075.
?>
076.
x = <?=
$intRows
;?>;
077.
mySubList =
new
Array();
078.
079.
strGroup = <?=
$objResult
[
"degree_id"
];?>;
080.
strValue =
"<?=$objResult["
curr_id
"];?>"
;
081.
strItem =
"<?=$objResult["
curr_name
"];?>"
;
082.
mySubList[x,0] = strItem;
083.
mySubList[x,1] = strGroup;
084.
mySubList[x,2] = strValue;
085.
if
(mySubList[x,1] == SelectValue){
086.
var
myOption =
new
Option(mySubList[x,0], mySubList[x,2])
087.
formAddThesis.ddlcurr.options[formAddThesis.ddlcurr.length]= myOption
088.
}
089.
<?
090.
}
091.
?>
092.
}
093.
094.
095.
096.
097.
function
Listmajor(SelectValue)
098.
{
099.
formAddThesis.ddlmajor.length = 0
100.
101.
102.
var
myOption =
new
Option(
''
,
''
)
103.
formAddThesis.ddlmajor.options[formAddThesis.ddlmajor.length]= myOption
104.
105.
<?
106.
$intRows
= 0;
107.
$strSQL
=
"SELECT * FROM tb_major ORDER BY major_id ASC "
;
108.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
109.
$intRows
= 0;
110.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
111.
{
112.
$intRows
++;
113.
?>
114.
x = <?=
$intRows
;?>;
115.
mySubList =
new
Array();
116.
117.
strGroup = <?=
$objResult
[
"curr_id"
];?>;
118.
strValue =
"<?=$objResult["
major_id
"];?>"
;
119.
strItem =
"<?=$objResult["
major_name
"];?>"
;
120.
mySubList[x,0] = strItem;
121.
mySubList[x,1] = strGroup;
122.
mySubList[x,2] = strValue;
123.
124.
if
(mySubList[x,1] == SelectValue){
125.
var
myOption =
new
Option(mySubList[x,0], mySubList[x,2])
126.
formAddThesis.ddlmajor.options[formAddThesis.ddlmajor.length]= myOption
127.
}
128.
<?
129.
}
130.
?>
131.
}
132.
133.
134.
</script>
135.
</HEAD>
136.
<BODY topMargin=0>
137.
<form id=
"formAddThesis"
name=
"formAddThesis"
method=
"post"
onSubmit=
'return Checkdata(this);'
action=
"xxx.php"
>
138.
139.
<div align=
"left"
></div>
140.
<br>
141.
<table width=
"595"
border=
"0"
bordercolor=
"#666666"
cellpadding=2 cellspacing=2>
142.
<tbody>
143.
<tr>
144.
<td height=10
class
=
"style10"
><div align=
"left"
> <span
class
=
"style102"
>ระดับ</span></div></td>
145.
<td height=10 colspan=
"2"
class
=
"style10"
>
146.
<!-- เริ่ม -->
147.
<select id=
"ddldegree"
name=
"ddldegree"
onChange =
"Listcurr(this.value)"
class
=
"style10"
style=
'background-color:#FFFFCC; color:#0000FF;width:180px'
>
148.
<option selected value=
""
></option>
149.
<?
150.
$strSQL
=
"SELECT * FROM tb_degree ORDER BY degree_id ASC "
;
151.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
152.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
153.
{
154.
?>
155.
<option value=
"<?=$objResult["
degree_id
"];?>"
>
156.
<?=
$objResult
[
"degree_name"
];?>
157.
</option>
158.
<?
159.
}
160.
?>
161.
</select></td>
162.
</tr>
163.
<tr>
164.
<td height=10
class
=
"style10"
><div align=
"left"
> หลักสูตร</div></td>
165.
<td height=10 colspan=
"2"
class
=
"style10"
><select id=
"ddlcurr"
name=
"ddlcurr"
style=
'background-color:#CCFFFF; color:#0000FF;width:180px'
onChange =
"Listmajor(this.value)"
> </select></td>
166.
</tr>
167.
<tr>
168.
<td height=10
class
=
"style10"
><div align=
"left"
> สาขาวิชา</div></td>
169.
<td height=10 colspan=
"2"
class
=
"style10"
><select id=
"ddlmajor"
name=
"ddlmajor"
style=
'background-color:#FFFFCC; color:#0000FF;width:320px'
>
170.
</select>
171.
<?
172.
mysql_close(
$objConnect
);
173.
?></td>
174.
</tr>
175.
<tr>
176.
<td height=10 colspan=
"3"
><div align=
"center"
>
177.
<input name=
"submit3"
type=
"Submit"
onClick=
'return Checkdata(this);'
size=
'2'
style=
'background-color:#9999FF; color:#000000;'
value=
"บันทึก"
>
178.
</div></td>
179.
</tr>
180.
</tbody>
181.
</table>
182.
</form>
183.
</BODY></HTML>