001.
<form id=
"form1"
name=
"form1"
method=
"post"
action=
"saves.php"
>
002.
<?
003.
$status=$_SESSION[
'status'
];
004.
005.
$id1=$_SESSION[
'id_a'
];
006.
007.
?>
008.
<p align=
"center"
>การให้คำปรึกษา</p>
009.
<table width=
"528"
border=
"0"
align=
"center"
>
010.
<tr>
011.
<th width=
"114"
scope=
"col"
><div align=
"right"
>หัวข้อเรื่อง:</div></th>
012.
<th colspan=
"2"
scope=
"col"
><div align=
"left"
>
013.
<input name=
"head"
type=
"text"
id=
"head"
size=
"40"
/>
014.
</div></th>
015.
</tr>
016.
<tr>
017.
<td> </td>
018.
<td colspan=
"2"
> </td>
019.
</tr>
020.
<tr>
021.
<td><div align=
"center"
><strong>รายละเอียด:</strong></div></td>
022.
<td colspan=
"2"
><textarea name=
"detail"
id=
"detail"
cols=
"40"
rows=
"5"
></textarea></td>
023.
</tr>
024.
<tr>
025.
<td> </td>
026.
<td colspan=
"2"
> </td>
027.
</tr>
028.
029.
<?php
if
($row_t[
'status'
]==
'1'
) { ?>
030.
<?
031.
<tr>
032.
<td height=
"27"
><div align=
"center"
><strong>หมุ่เรียน:</strong></div></td>
033.
<td width=
"154"
><label>
034.
<select name=
"a"
id=
"a"
title=
"<?php echo $row_rs_class['name_class']; ?>"
onChange =
"ListRoom(this.value)"
>
035.
<?php
036.
do
{
037.
?>
038.
<option value=
"<?php echo $row_rs_class['name_class']?>"
><?php echo $row_rs_class[
'name_class'
]?></option>
039.
<?php
040.
}
while
($row_rs_class = mysql_fetch_assoc($rs_class));
041.
$rows = mysql_num_rows($rs_class);
042.
if
($rows > 0) {
043.
mysql_data_seek($rs_class, 0);
044.
$row_rs_class = mysql_fetch_assoc($rs_class);
045.
}
046.
?>
047.
</select>
048.
</label>
049.
<?php
050.
do
{
051.
?>
052.
053.
</td>
054.
<option value=
"<?php echo $row_rs_class['name_class']?>"
<?php
if
(!(strcmp($row_rs_class[
'name_class'
], $row_a[
'class_'
]))) {echo
"selected=\"selected\""
;} ?>></option>
055.
<?php
056.
}
057.
while
($row_rs_class = mysql_fetch_assoc($rs_class));
058.
$rows = mysql_num_rows($rs_class);
059.
if
($rows > 0) {
060.
mysql_data_seek($rs_class, 0);
061.
$row_rs_class = mysql_fetch_assoc($rs_class);
062.
}
063.
?>
064.
</tr>
065.
<tr>
066.
<td><div align=
"center"
><strong>ถึงนักศึกษาในที่ปรึกษา:</strong></div></td>
067.
<td colspan=
"2"
><label>
068.
<select name=
"id_stu"
id=
"id_stu"
onChange =
"ListRoom(this.value)"
/>
069.
<option value=
"<?=$id_stu?>"
>
070.
<?
if
($id_stu){echo
"$id"
;}
else
if
(!$id_stu){echo
"เลือก"
;}?>
071.
</option>
072.
</select>
073.
</label></td>
074.
</tr>
075.
<? } ?>
076.
<tr>
077.
<td> </td>
078.
<td><?php
if
($row_t[
'status'
]==
'0'
) { echo $row_teach[
'name_tech'
];} ?></td>
079.
</tr>
080.
<tr>
081.
<td> </td>
082.
<td colspan=
"2"
><input type=
"submit"
name=
"button"
id=
"button"
value=
"ส่งข้อมูล"
/></td>
083.
</tr>
084.
</table>
085.
<br>
086.
<?
087.
088.
?>
089.
090.
<script language=
"javascript"
type=
"text/javascript"
>
091.
092.
function setage()
093.
{
094.
var selectList = document.frmselect(
"name"
);
095.
for
(i=0;i<selectList.options.length;i++)
096.
{
097.
selectList.removeChild(selectList.options.item(i));
098.
}
099.
100.
var index_name=document.frmselect.name.selectedIndex;
101.
102.
103.
104.
document.frmselect.age.selectedIndex=index_name;
105.
106.
}
107.
</script>
108.
</form>
109.
110.
<script>
111.
function ListRoom(SelectValue)
112.
{
113.
form1.id_stu.length = 0
114.
115.
116.
var myOption =
new
Option(
''
,
''
)
117.
form1.id_stu.options[form1.id_stu.length]= myOption
118.
119.
<?
120.
$intRows = 0;
121.
$strSQL =
"SELECT * FROM adv_data "
;
122.
$objQuery = mysql_query($strSQL) or die (
"Error Query ["
.$strSQL.
"]"
);
123.
$intRows = 0;
124.
while
($objResult = mysql_fetch_array($objQuery))
125.
{
126.
$intRows++;
127.
?>
128.
x = <?=$intRows;?>;
129.
var mySubList =
new
Array();
130.
131.
var strID = <?=$objResult[
"id"
];?>;
132.
var strName =
"<?=$objResult["
fname
"];?>"
;
133.
var strLastName =
"<?=$objResult["
lname
"];?>"
;
134.
var status =
"<?=$objResult["
status
"];?>"
;
135.
mySubList[x,0] = strID;
136.
mySubList[x,1] = strName;
137.
mySubList[x,2] = strLastName;
138.
mySubList[x,3] = status;
139.
140.
141.
if
(mySubList[x,3] == 0){
142.
var myOption =
new
Option(mySubList[x,1], mySubList[x,2])
143.
form1.id_stu.options[form1.id_stu.length]= myOption
144.
}
145.
<?
146.
}
147.
?>
148.
}
149.
150.
</script>