|
 |
|
รบกวนสอบถาม Mr.win เรื่องเกี่ยวกับ combobox 2 แก้ไขแล้วข้อมูลไม่ขึ้นค่ะ |
|
 |
|
|
 |
 |
|
รบกวนดูโค้ดให้หน่อยค่ะ
ลองทำตามและรันดูหลายรอบ ไม่โชว์ข้อมูลค่ะ ไม่รู้ว่าต้องแก้ไขตรงไหน ลองผิดลองถูกมาหลายวันแล้ว ขอบคุณมากนะค่ะ

Code (PHP)
<?php
/*** By Weerachai Nukitram ***/
/*** http://www.ThaiCreate.Com ***/
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("money");
@mysql_query("SET NAMES UTF8");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ThaiCreate.Com ListMenu</title>
<script language = "JavaScript">
//**** List Province (Start) ***//
function ListAccount(SelectValue)
{
frmMain.ddlAccount.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('','')
frmMain.ddlAccount.options[frmMain.ddlAccount.length]= myOption
<?
$intRows = 0;
$strSQL = "SELECT * FROM account ORDER BY Account_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["group_id"];?>;
strValue = "<?=$objResult["Account_id"];?>";
strItem = "<?=$objResult["Account_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])
frmMain.ddlAccount.options[frmMain.ddlAccount.length]= myOption
}
<?
}
?>
}
//**** List Province (End) ***//
</script>
</head>
<form name="frmMain" action="" method="post">
หมวดรายจ่าย
<select id="ddlGroup" name="ddlGroup" onChange = "ListAccount(this.value)">
<option value=""></option>
<?
$strSQL = "SELECT * FROM group ORDER BY group_id ASC ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
while($objResult = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResult["group_id"];?>" selected>
<?=$objResult["name"];?>
</option>
<?
}
?>
</select>
รายชื่อบัญชี
<select id="ddlAccount" name="ddlAccount" style="width:120px" >
</select>
</form>
</body>
</html>
<?
mysql_close($objConnect);
?>
Tag : PHP, JavaScript

|
ประวัติการแก้ไข 2012-08-22 10:37:42
|
 |
 |
 |
 |
Date :
2012-08-22 10:36:07 |
By :
pum374 |
View :
1051 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
น่าจะมีอะไรผิดซะอย่างครับ ลอง View Source ในหน้า Web Browser มาให้หน่อยครับ
|
 |
 |
 |
 |
Date :
2012-08-22 21:44:15 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ThaiCreate.Com ListMenu</title>
<script language = "JavaScript">
//**** List Province (Start) ***//
function ListAccount(SelectValue)
{
frmMain.ddlAccount.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('','')
frmMain.ddlAccount.options[frmMain.ddlAccount.length]= myOption
x = 1;
mySubList = new Array();
strGroup = "1";
strValue = "1.1";
strItem = "เงินเดือน เงินประจำตำแหน่งและค่าจ้างประจำ";
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.ddlAccount.options[frmMain.ddlAccount.length]= myOption
}
x = 2;
mySubList = new Array();
strGroup = "1";
strValue = "1.2";
strItem = "ค่าจ้างชั่วคราว";
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.ddlAccount.options[frmMain.ddlAccount.length]= myOption
}
x = 3;
mySubList = new Array();
strGroup = "1";
strValue = "1.3";
strItem = "เงินสมทบประกันสังคม5%";
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.ddlAccount.options[frmMain.ddlAccount.length]= myOption
}
}
//**** List Province (End) ***//
</script>
</head>
<form name="frmMain" action="" method="post">
หมวดรายจ่าย
<select id="ddlGroup" name="ddlGroup" onChange = "ListAccount(this.value)">
<option value=""></option>
Error Query [SELECT * FROM group ORDER BY group_id ASC ]
ขอบคุณมากค่ะ
|
ประวัติการแก้ไข 2012-08-27 14:34:58
 |
 |
 |
 |
Date :
2012-08-27 14:33:31 |
By :
pum374 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แก้ได้แล้ว
ขอบคุณ mr.win มากนะค่ะ  
|
 |
 |
 |
 |
Date :
2012-08-28 14:04:24 |
By :
pum374 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ดีใจด้วยครับ
|
 |
 |
 |
 |
Date :
2012-08-28 20:50:49 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|