|
 |
|
เราจะมีวิธีการส่งค่ายังไง โดยให้มันเก็บ id_product ด้วย แต่ตอนแสดงใน textbox ให้แสดงแค่ unit อย่างเดียวค่ะ |
|
 |
|
|
 |
 |
|
เราจะมีวิธีการส่งค่ายังไง โดยให้มันเก็บ id_product ด้วย แต่ตอนแสดงใน textbox ให้แสดงแค่ unit คือตอนนี้ที่ทำได้คือ มันเก็บ id_product แล้ว และตอนแสดงใน textbox มันแสดงทั้ง id_product,unit
Code (PHP)
function ListProvince(SelectValue)
{
frmMain.ddlProvince.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('','')
frmMain.ddlProvince.options[frmMain.ddlProvince.length]= myOption
<?
$intRows = 0;
$strSQL = "SELECT * FROM product ";
$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["id_category"];?>;
strValue = "<?=$objResult["id_product"];?>,<?=$objResult["unit"];?>"; //น่าจะเป็นตรงนี้ แต่แก้ไม่ถูกค่ะ//
strItem = "<?=$objResult["pname"];?>";
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.ddlProvince.options[frmMain.ddlProvince.length]= myOption
}
<?
}
?>
}
Code (PHP)
<select id="select4" name="ddlProvince" onChange="frmMain.txtVol.value=this.value" ></select>
Code (PHP)
<input name="txtVol" type="text" size="10">
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2012-11-05 16:26:47 |
By :
sumonrat |
View :
842 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองใช้วิธีการเก็บค่าแบบ session ดูนะครับ
|
 |
 |
 |
 |
Date :
2012-11-06 13:31:20 |
By :
namebom |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|