|
 |
|
รบกวนหน่อยครับ จากโค๊ดพี่วิน เอาไปดัดแปลงแก้ไข แล้วต้องการเพิ่มบางอย่าง |
|
 |
|
|
 |
 |
|
ผมต้องการเพิ่มส่วนที่ส่งค่า id ไปใส่ใน textbox น่ะครับ พอจะทำได้หรือป่าว เป็นส่วนจาวาโค๊ดนะครับ ขอบคุณครับ
Code (PHP)
<script language = "JavaScript">
//**** List ListShipping (Start) ***//
function ListShipping(SelectValue)
{
frmMain.ddlshipping.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('กรุณาเลือก','')
frmMain.ddlshipping.options[frmMain.ddlshipping.length]= myOption
<?
$intRows = 0;
$strSQL = "select * from company";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$intRows = 0;
$first="";
while($objResult = mysql_fetch_array($objQuery))
{
if(!$first){ $first=$obJResult['companyability']; }
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup = <?=$objResult["provinceid"];?>;
strValue = "<?=$objResult["companyability"];?>";
strItem = "<?=$objResult["companyname"];?>";
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.ddlshipping.options[frmMain.ddlshipping.length]= myOption
}
<?
}
?>
}
//**** List ListShipping (End) ***//
</script>
Tag : PHP, Ajax, jQuery, CakePHP

|
|
 |
 |
 |
 |
Date :
2011-09-18 14:35:09 |
By :
Dragons_first |
View :
816 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เพิ่มCode (JavaScript)
<script language = "JavaScript">
//**** List ListShipping (Start) ***//
function ListShipping(SelectValue)
{
frmMain.hdnXXX.value = SelectValue;
frmMain.ddlshipping.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('กรุณาเลือก','')
frmMain.ddlshipping.options[frmMain.ddlshipping.length]= myOption
<?
$intRows = 0;
$strSQL = "select * from company";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$intRows = 0;
$first="";
while($objResult = mysql_fetch_array($objQuery))
{
if(!$first){ $first=$obJResult['companyability']; }
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup = <?=$objResult["provinceid"];?>;
strValue = "<?=$objResult["companyability"];?>";
strItem = "<?=$objResult["companyname"];?>";
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.ddlshipping.options[frmMain.ddlshipping.length]= myOption
}
<?
}
?>
}
//**** List ListShipping (End) ***//
</script>
ลองดูแบบนี้ก็ได้ครับ
|
 |
 |
 |
 |
Date :
2011-09-18 15:37:45 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คุณวินคะ
มีเรื่องสอบถามค่ะ เริ่มต้นไม่ถูกเลยค่ะ ล้างลาการเขียนโปรแกรมมานาน พอดี search ข้อมูลที่จะนำไปเขียนโปรแกรม แล้ว concept มันเหมือนกับอย่างที่ทำเลยค่ะ แต่ เริ่มต้นไม่ถูก พอมี code ตัวอย่างไหมคะ
พอดีจะทำโปรแกรมคล้าย helpdesk log ค่ะ หมายถึงทำโปรแกรมแจ้งปัญหาและแจ้งซ่อมอ่ะค่ะ แต่ว่า ความต้องการคืออยากจะให้ใช้ แบบลากแปะ draganddrop ก็ไปเจอ jqueryUI แต่ ความต้องการคือ ลาก ตัวแสดงผลที่เราดึงมาจากฐานข้อมูล (Job งานที่ถูกร้องขอเข้ามา) แล้วเราก็สามารถเลือกได้ว่าเราจะเลือก jobid เรือ่งใด โดยการลาก มาแปะ ใน area หรือ textbox แล้ว retrive ฐานข้อมูลที่เราจะแก้ไขมา ไว้ในฟอร์มที่เราจะ edit อ่ะค่ะ
อยากใช้ ลากแปะดึงจากฐานข้อมูล หาตัวอย่างไม่ค่อยเจอเลยค่ะ ขอคำชี้แนะด้วยนะคะ ขอบคุณค่ะ สามารถ add msn เพื่อปรึกษาได้ไหมคะ
[email protected]
ขอบคุณอีกครั้งค่ะ
|
 |
 |
 |
 |
Date :
2011-09-18 17:08:53 |
By :
Laaonnoi |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณครับพี่วินเด๋วจะลองดู
|
 |
 |
 |
 |
Date :
2011-09-18 17:26:42 |
By :
Dragons_first |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
รบกวนอีกทีครับ ในตาราง company มีฟิลด์ companyid จะส่งไปยังไงครับ เขียนแบบนี้ได้หรือป่าว
Code (PHP)
<script language = "JavaScript">
//**** List ListShipping (Start) ***//
function ListShipping(SelectValue)
{
frmMain.hdnXXX.value = strId;////แบบนี้
frmMain.ddlshipping.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('กรุณาเลือก','')
frmMain.ddlshipping.options[frmMain.ddlshipping.length]= myOption
<?
$intRows = 0;
$strSQL = "select * from company";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$intRows = 0;
$first="";
while($objResult = mysql_fetch_array($objQuery))
{
if(!$first){ $first=$obJResult['companyability']; }
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup = <?=$objResult["provinceid"];?>;
strValue = "<?=$objResult["companyability"];?>";
strItem = "<?=$objResult["companyname"];?>";
strId = "<?=$objResult["companyid"];?>";///ตั้งค่าตัวแปรแบบนี้ ไม่ทราบว่าจะได้หรือป่าวครับ
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.ddlshipping.options[frmMain.ddlshipping.length]= myOption
}
<?
}
?>
}
//**** List ListShipping (End) ***//
</script>
|
ประวัติการแก้ไข 2011-09-19 11:32:52
 |
 |
 |
 |
Date :
2011-09-19 11:32:22 |
By :
Dragons_first |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|