|
|
|
อยากทราบว่า การค้นหาเเบบนี้ เราจะต่อยอด ที่รับค่าจาก listbox ที่เราเลือก ถ้ากดปุ่มค้นหาเเล้ว ต้องการให้มันเเสดงตารางออกมาหน้าเดิม เราต้องเพิ่มส่วนไหนเข้าไป ช่วยทีจ้า ขอบคุณจ้า |
|
|
|
|
|
|
|
Code (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="StylePayment_std.css" rel="stylesheet" type="text/css" />
<script language = "JavaScript">
//**** List area (Start) ***//
function Listroom(SelectValue)
{
frmMain.room.length = 0
var myOption = new Option('','')
<?
$grouproom=array(1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3 ,3,3,3,3,3,3,3,4,4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6);
$room=array("1","2","3","4","5","6","7","8","9","10","1","2" ,"3","4","5","6","7","8","9","10","1","2","3","4","5","6","7" ,"8","9","10","1","2","3","4","5","6","7","1","2","3","4","5","6","1","2","3","4","5","6");
for($i=0;$i<49;$i++){
?>
x = "<?=$i;?>";
mySubList = new Array();
strGroup = "<?=$grouproom[$i];?>";
strValue = "<?=$i;?>";
strItem = "<?=$room[$i];?>";
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.room.options[frmMain.room.length]= myOption
}
<?
}
?>
}
</script>
<title>Untitled Document</title>
</head>
<body>
<form action="<?=$_SERVER['SCRIPT_NAME'];?>" method="get" name="frmSearch" id="frmMain" onsubmit = "return CheckForm()">
ชั้น
<select id="class" name="class" onChange = "Listroom(this.value)">
<?
$class = array("เลือกชั้น","1","2","3","4","5","6");
for($j=0;$j<7;$j++){
?>
<option value="<?=$j; ?>"><?=$class[$j];?></option>
<?
}
?>
</select>
ห้อง
<select id="room" name="room" style="width:80px" >
<option value="">เลือกห้อง</option>
</select>
<input type="submit" name="button" id="button" value="ค้นหา" />
</form>
Tag : PHP, HTML/CSS, JavaScript, Ajax
|
ประวัติการแก้ไข 2012-08-06 17:00:38 2012-08-06 17:01:29
|
|
|
|
|
Date :
2012-08-06 16:59:23 |
By :
harmunza |
View :
845 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้วใช้พวก jQuery กับ Ajax เข้ามาช่วยครับ
|
|
|
|
|
Date :
2012-08-07 06:35:00 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|