|
 |
|
ปัญหาการทำ listmenu แล้วโชว์ข้อมุลหลายๆ text box แก้ไม่ได้ค่ะ รบกวนด้วยค่ะ |
|
 |
|
|
 |
 |
|
ภาพที่ 1 ผลลัพธ์ตามโค้ดค่ะ
<!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" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#select').change(function(){
var longstring = $(this).val();
var string=longstring.split(",");
for (var i = 0; i<string.length; i++){
$('#Itemname').val(string[0]);
$('#Spec').val(string[1]);
$('#Size').val(string[2]);
}
})
});
</script>
</head>
<body>
<form id="frm" name="frm" method="post" action="">
<?
include('connect.php');
$sql_itemno = "select ITEM_NO,ITEM_NAME,SPEC,SIZE from item ";
$result_itemno = mysql_query($sql_itemno) or die ("Error Query [".$sql_itemno."]"); ;
?>
<select name="select" id="select" onChange="FillValue(this.value)">
<option value=""> => Select Item No<= </option>
<?
while($result = mysql_fetch_array($result_itemno ))
{
?>
<option value="<?=$result["ITEM_NAME"];?>,<?=$result["SPEC"];?>,<?=$result["SIZE"];?>"> <?=$result["ITEM_NO"];?>
</option>
<?
}
?>
</select>
Item
<input type="text" name="Itemname" id="Itemname" Value=""/>
Spec
<input type="text" name="Spec" id="Spec" Value="" />
Size
<input type="text" name="Size" id="Size" Value="" />
</form>
</body>
</html>
ภาพที่ 2 ผลลัพธ์ตามโค้ดค่ะ
<!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=windows-874" />
<title>PoCustomer Form</title>
<style type="text/css">
<!--
.style2 {font-family: "Arial Unicode MS"; font-size: small; }
.style4 {font-family: "Arial Unicode MS"; font-size: small; color: #CCFF33; }
.style5 {
font-family: "Arial Unicode MS";
color: #000000;
font-weight: bold;
}
-->
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#select').change(function(){
var longstring = $(this).val();
var string=longstring.split(",");
for (var i = 0; i<string.length; i++){
$('#Itemname').val(string[0]);
$('#Spec').val(string[1]);
}
})
});
</script>
</head>
<body>
<form id="frm" name="frm" method="post" action="">
<table width="99%" border="1" align="center" cellpadding="5" cellspacing="5">
<tr>
<th colspan="2" align="center" valign="baseline" bgcolor="#33CCFF" scope="col"><h1><span class="style5"> PO CUSTOMER
</span>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','278','height','200','align','absmiddle','title','clock_calendar','src','images/clock_calendar','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#66CCFF','wmode','transparent','movie','images/clock_calendar' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="278" height="200" align="absmiddle" title="clock_calendar">
<param name="wmode" value="transparent">
<param name="movie" value="images/clock_calendar.swf" /><param name="BGCOLOR" value="#66CCFF" />
<embed src="images/clock_calendar.swf" width="278" height="200" align="absmiddle" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#66CCFF"></embed>
</object>
</noscript>
</h1></th>
</tr>
<tr>
<td width="12%">CUS__NAME</td>
<td width="88%"><label>
<?
include('connect.php');
$sql_cus = "select CUS_NO,CUS_NAME,NAME from customer ";
$result_cus = mysql_query($sql_cus) or die ("Error Query [".$sql_cus."]"); ;
?>
<select name="lstcus" size="1" id="select" onChange="frm.Salesname.value=this.value">
<?php
while($result = mysql_fetch_array($result_cus ))
{
?>
<option value="<?=$result["NAME"];?>"><?=$result["CUS_NAME"];?>
</option>
<?
}
?>
</select></label></td>
</tr>
<tr>
<td>CUS_PO_NO</td>
<td><label>
<input name="CusPoNo" type="text" id="CusPoNo" />
</label></td>
</tr>
<tr>
<td>ACCEP DATE</td>
<td>
<label>
<input type="text" name="date" id="date" value="<?=date('Y-m-d')?>"/>
</label></td>
</tr>
<tr>
<td>DELIVERY DATE</td>
<td><label>
<input type="text" name="date1" id="date" value="<?=date('Y-m-d' )?>"/>
</label></td>
</tr>
<tr>
<td>PAYMENT</td>
<td><label>
<input name="Payment" type="text" id="Payment" />
</label></td>
</tr>
<tr>
<td>SALES_NAME</td>
<td><label>
<input name="Salesname" type="text" id="Salesname" size="40" />
</label></td>
</tr>
<tr>
<td>REMARK</td>
<td><label>
<textarea name="Remark" cols="40" rows="2" id="Remark"></textarea>
</label></td>
</table>
<table width="1303" border="1" align="center">
<tr bordercolor="#FF0000" bgcolor="#555555" class="style2">
<td width="187"><div align="center">
<span class="style4">ITEM NO</span></td>
<td width="283"> <div align="center">
<span class="style4">ITEM NAME</span></td>
<td width="270"><div align="center">
<span class="style4">SPEC</span></td>
<td width="213"><div align="center">
<span class="style4">SIZE</span></td>
<td width="36"><div align="center">
<span class="style4">PCS</span></td>
<td width="44"><div align="center">
<span class="style4">CURR</span></td>
<td width="79"><div align="center">
<span class="style4">UNITPRICE</span></td>
<td><div align="center">
<span class="style4">SUM TOTAL</span></td>
</tr>
<tr>
<td><lable>
<?
include('connect.php');
$sql_itemno = "select ITEM_NO,ITEM_NAME,SPEC,SIZE from item ";
$result_itemno = mysql_query($sql_itemno) or die ("Error Query [".$sql_itemno."]"); ;
?>
<select name="select" id="select" onChange="FillValue(this.value)">
<option value=""> => Select Item No<= </option>
<?
while($result = mysql_fetch_array($result_itemno ))
{
?>
<option value="<?=$result["ITEM_NAME"];?>,<?=$result["SPEC"];?>"> <?=$result["ITEM_NO"];?>
</option>
<?
}
?>
</select>
</label> </td>
<td><input name="Itemname" type="text" id="Itemname" Value="" size="40"> </td>
<td><input name="Spec" type="text" id="Spec" Value="" size="40" /></td>
<td><input name="Size" type="text" id="Size" size="35" /></td>
<td><input name="Pcs" type="text" id="Pcs" size="6" /></td>
<td><input name="Currsales" type="text" id="Currsales" size="6" /></td>
<td><input name="Unitprice" type="text" id="Unitprice" size="10" /></td>
<td width="139"><input name="Sumtotal" type="text" id="Subtotal" size="10" /></td>
</tr>
<tr>
<td><input name="txtConfirmPassword3" type="password" id="txtConfirmPassword3" size="15" /></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input name="txtConfirmPassword4" type="password" id="txtConfirmPassword4" size="15" /></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input name="txtConfirmPassword5" type="password" id="txtConfirmPassword5" size="15" /></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input name="txtConfirmPassword6" type="password" id="txtConfirmPassword6" size="15" /></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input name="txtConfirmPassword7" type="password" id="txtConfirmPassword7" size="15" /></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input name="txtConfirmPassword8" type="password" id="txtConfirmPassword8" size="15" /></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input name="txtConfirmPassword9" type="password" id="txtConfirmPassword9" size="15" /></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input name="txtConfirmPassword10" type="password" id="txtConfirmPassword10" size="15" /></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input name="txtConfirmPassword11" type="password" id="txtConfirmPassword11" size="15" /></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input name="txtConfirmPassword12" type="password" id="txtConfirmPassword12" size="15" /></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input name="txtConfirmPassword13" type="password" id="txtConfirmPassword13" size="15" /></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input name="txtConfirmPassword14" type="password" id="txtConfirmPassword14" size="15" /></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input name="txtConfirmPassword15" type="password" id="txtConfirmPassword15" size="15" /></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<p> </p>
</form>
</body>
</html>
ปัญหาคืออย่างได้แบบที่สองค่ะ พอเขียนโค้ดเพิ่มเติมแล้ว list item no กลับไม่โชว์ข้อมูลไม่ทราบว่าเีขียนโค้ดวางผิดตำแหน่ง
หรือว่าผิดตรงไหนหรือเปล่า ไม่แน่ใจค่ะ เพราะโค้ดอันแรกไม่มีตารางส่วนบนเพิ่มเข้ามาเวลาเลือกข้อมูลในลิสถึงทำได้
แต่พอโค้ดอันที่สอง listmenu กลับใช้ไม่ได้เพราะถูกให้อยู่ในแท็กตารางหรือเปล่าค่ะ แก้หลายรอบแล้วก็ทำไม่ได้ค่ะ
รบกวนช่วยแนะนำหน่อยค่ะ ขอบคุณค่ะ
Tag : PHP, MySQL, JavaScript, Ajax

|
|
 |
 |
 |
 |
Date :
2010-11-12 08:22:13 |
By :
taewengja |
View :
842 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Item
<input type="text" name="Itemname" id="Itemname" Value=""/>
Spec
<input type="text" name="Spec" id="Spec" Value="" />
Size
<input type="text" name="Size" id="Size" Value="" />
[font=Verdana]<td><input name="Itemname" type="text" id="Itemname" Value="" size="40"> </td>
<td><input name="Spec" type="text" id="Spec" Value="" size="40" /></td>
<td><input name="Size" type="text" id="Size" size="35" /></td>
<td><input name="Pcs" type="text" id="Pcs" size="6" /></td>
<td><input name="Currsales" type="text" id="Currsales" size="6" /></td>
<td><input name="Unitprice" type="text" id="Unitprice" size="10" /></td>
<td width="139"><input name="Sumtotal" type="text" id="Subtotal" size="10" /></td>
</tr>[/font]
input บางตัวไม่มี value ไม่แน่ใจจะเกียวรึป่าวนะครับ รอ ผู้ร็ท่านอื่นลักัน
|
 |
 |
 |
 |
Date :
2010-11-12 12:38:16 |
By :
mulline |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|