|
|
|
ว่าด้วยเรื่อง เลือก List Menu แล้วแสดงข้อมูลอัตโนมัติ |
|
|
|
|
|
|
|
ลองเอาตัวนี้ไปดัดแปลงดู
Code (PHP)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<?
include("../include/class.mysqldb.php");
include("../include/config.inc.php");
?>
<script type="text/javascript">
//**** List promotion (Start) ***//
function ListUnit(SelectValue)
{
regis.proid.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('','')
regis.proid.options[regis.proid.length]= myOption
<?
$intRows = 0;
$strSQL = "SELECT * FROM promotion where pro_status='1' ORDER BY pro_id ASC ";
$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["unit_id"];?>;
strValue = "<?=$objResult["pro_id"];?>";
strItem = "<?=$objResult["pro_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])
regis.proid.options[regis.proid.length]= myOption
//regis.zipcode.value= strGroup;
}
<?
}
?>
}
</script>
</head>
<body>
<form action="save_cus.php" method="post" name="regis" >
<table>
<tr>
<td align="right">ประเภทโปรโมชั่น :</td>
<td align="left"><label>
<select id="unit_id" name="unit_id" style="width:100px" onChange = "ListUnit(this.value)" onBlur="chkunit_id();">
<option selected value="">- กรุณาเลือก -</option>
<?
$strSQL = "SELECT * FROM unit ORDER BY unit_id ASC ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
while($objResult = mysql_fetch_array($objQuery))
{
$unit_id=$objResult["unit_id"];
$unit_name=$objResult["unit_name"];
echo "<option value=\"$unit_id\"";
if($objResult["unit_id"]==$row_show["unit_id"]){
echo "selected";
}
echo ">$unit_name</option>";
}
?>
</select>
</label></td>
<td><span id="msg_unitid" class="text7"></span></td>
</tr>
<tr>
<td align="right">ชื่อโปรโมชั่น :</td>
<td align="left"><label>
<select name="proid" id="proid" onBlur="chkpro();" style="width:100px"></select>
</label></td>
<td><span id="msg_pro" class="text7"></span></td>
</tr>
</table>
</form>
</body>
</html>
|
|
|
|
|
Date :
2012-03-13 22:54:55 |
By :
000su000 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณค่ะ เดี่ยวจะลองดู
|
|
|
|
|
Date :
2012-03-13 22:59:35 |
By :
lookpla26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ยังไม่ได้อ้ะค้ะ
|
|
|
|
|
Date :
2012-03-13 23:09:55 |
By :
lookpla26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|