Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,028

HOME > PHP > PHP Forum > ช่วยดู code ให้หน่อยครับว่ามันผิดตรงไหน ผมทำ list menu ที่ดึงข้อมูลมาจาก database แต่ข้อมูลมันไม่ Auto fill ให้ครับ



 

ช่วยดู code ให้หน่อยครับว่ามันผิดตรงไหน ผมทำ list menu ที่ดึงข้อมูลมาจาก database แต่ข้อมูลมันไม่ Auto fill ให้ครับ

 



Topic : 083164



โพสกระทู้ ( 48 )
บทความ ( 0 )



สถานะออฟไลน์




คือผมทำ list menu ที่ดึงข้อมูลจากฐานข้อมูลมา แล้วผมก็ทำให้ข้อมูลใน text box แสดงแบบ Auto fill ปัญหามีอยู่ว่า ถ้าผมทำการ add ข้อมูลทีละแถวมัน Auto fill ให้ แต่ถ้าผมทำการ add ข้อมูลแบบหลายแถวเมื่อไหร่ มันจะไม่ auto fill ให้ผม แก้ code หลายรอบและ ผมไม่แน่ใจว่าต้องแก้ตรงไหนของ function หรือตรงไหนของ code ยังไงรบกวนช่วยดูให่หน่อยครับ ผมแนบรูปกับ code มาให้ด้วยครับ

Auto fill
unselete 1

ไม่ Auto fill
unselete 2

Code (PHP)
<html>
<head>
	<LINK REL="SHORTCUT ICON" HREF="JPG/logo.ico" />
	<title> Logistic Oversea (GW)</title>
	<meta name="Generator" content="EditPlus">
	<meta name="Author" content="">
	<meta name="Keywords" content="">
	<meta name="Description" content="">
	<STYLE type=text/css> 
		A:link {COLOR: #000000; TEXT-DECORATION: none} 
		A:visited {COLOR: #000000; TEXT-DECORATION: none} 
		A:hover {COLOR: #FF0000; TEXT-DECORATION: none} 
	</STYLE>
	<link rel="stylesheet" type="text/css" href="calendar/calendar.css">
	<script language="JavaScript" src="calendar/calendar_us.js"></script>
	<link rel="stylesheet" type="text/css" href="pro_dropdown_3/pro_dropdown_3.css" />
	<script src="pro_dropdown_3/stuHover.js" type="text/javascript"></script>
<script language="JavaScript" type="text/JavaScript">
	<!--
	function MM_jumpMenu(targ,selObj,restore){
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
	}
	function fncCal(_val){
		if(document.getElementById("txtordernum").value != ""){
			document.getElementById("txtPT").value = (document.getElementById("txtordernum").value*1) * (document.getElementById("txtPU").value*1);
		}
	}
	function fncCal2(_val){
		if(document.getElementById("txtThaibath").value != ""){
			document.getElementById("txtinclud").value = (document.getElementById("txtThaibath").value*1) + (document.getElementById("txtThaibath2").value*1) + (document.getElementById("txtinsurance").value*1) + (document.getElementById("txtvalue").value*1) + (document.getElementById("txtritual").value*1) + (document.getElementById("txtSCT").value*1) + (document.getElementById("txtinland").value*1) + (document.getElementById("txtother").value*1);
		}
	}
	function fncCal3(_val){
		if(document.getElementById("txtExchange").value != ""){
			document.getElementById("txtThaibath").value = (document.getElementById("txtExchange").value*1) * (document.getElementById("txtPT").value*1);
		}
	}
	function fncCal4(_val){
		if(document.getElementById("txtinclud").value != "" && document.getElementById("txtnum").value != ""){
			document.getElementById("txtPU2").value = (document.getElementById("txtinclud").value*1) / (document.getElementById("txtnum").value*1);
		}
	}
	function fncCal5(_val){
		if(document.getElementById("txtfreight").value != "" && document.getElementById("txtExchange2").value != ""){
			document.getElementById("txtThaibath2").value = (document.getElementById("txtfreight").value*1) * (document.getElementById("txtExchange2").value*1);
		}
	}
</script>
</head>	
	<script language="JavaScript">// code check right click
		var isNS = (navigator.appName == "Netscape") ? 1 : 0;
		if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);	 
		function mischandler(){
		  return false;
		}		 
		function mousehandler(e){
			var myevent = (isNS) ? e : event;
			var eventbutton = (isNS) ? myevent.which : myevent.button;
		   if((eventbutton==2)||(eventbutton==3)) return false;
		}
		document.oncontextmenu = mischandler;
		document.onmousedown = mousehandler;
		document.onmouseup = mousehandler; 
	</script>
	<script language="JavaScript">
		function resutName(STnum)
		{
			switch(STnum)
			{
				<?
					mysql_connect("localhost","root","1234") or die(mysql_error());
					mysql_select_db("sfg");
					$strSQL = "SELECT * FROM datamaterialgw ORDER BY STnum ASC";
					$objQuery = mysql_query($strSQL);
					while($objResult = mysql_fetch_array($objQuery)){
				?>
					case "<?=$objResult["STnum"];?>":
					frmAdd.txtlist.value = "<?=$objResult["list"];?>"; //แก้ตรงนี้ก็ไม่ได้ครับ
					break;
				<?
				}
				?>
				default:
				frmAdd.txtlist.value = "";
			}
		}
	</script>
	<?
		session_start();
		mysql_connect("localhost","root","1234");
		mysql_select_db("sfg");
		$strSQL2 = "SELECT * FROM user WHERE user = '".$_SESSION['user']."' ";
		$objQuery2 = mysql_query($strSQL2);
		$objResult = mysql_fetch_array($objQuery2);
		if($objResult["section"] != "Procurement"){
			header("location:index.php");
		}
		if($objResult["id"] != "499" and $objResult["id"] != "172" and $objResult["id"] != "003"){
			//header("location:index.php");
			echo "<meta http-equiv='Content-Type' content='text/html;' />";
			echo "<script language='javascript'>alert('You not have permission in this page.');history.back();</script>";
			exit();
		}
		mysql_close();
	?>
<body bgcolor="#eeeeee">
	<img src="JPG/lgs.gif" width="350" border="0" alt=""></td>
	<a href="http://www.trachang.co.th/Insulation" target="_blank"><img src="JPG/welcome-2.gif" width="150" height="50" border="0" alt=""></a>
	<a href="http://www.trachang.co.th/Insulation" target="_blank"><img src="JPG/welcome-3.gif" width="150" height="50" border="0" alt=""></a>
	<a href="http://www.trachang.co.th/Roof" target="_blank"><img src="JPG/welcome-4.gif" width="150" height="50" border="0" alt=""></a>
	<div id="no_print"> <?//no print?>
	<table>
		<tr>
			<td><font face="arial,tahoma,impact" size="5" color="#3a3a3a"><b>Welcome:</b></font></td>
			<td><font face="arial,tahoma,impact" size="5" color="#0000ff">&nbsp;<?=$objResult["fname"]; ?>&nbsp;</font></td>
			<td><a href="logout.php"><img src="JPG/logout.gif" width="60" border="0" alt=""></a></td>
		</tr>
	</table>
	<table width="5100">
		<tr>
			<td>
				<span class="preload1"></span>
				<span class="preload2"></span>
				<ul id="nav">
					<li class="top"><a href="logisticmenu.php" class="top_link"><span class="down"><font size="4">Urgently order</font></span></a>
						<ul class="sub">
							<li><a href="#" class="fly"><font size="4">- Urgently order GW</font></a>
								<ul>
									<li><a href="gwlogisticshow.php"><font size="4">- Urgently order Show</font></a></li>
									<li><a href="gwlogisticsearch.php"><font size="4">- Urgently order Search</font></a></li>
								</ul>
							</li>
							<li><a href="#" class="fly"><font size="4">- Urgently order GRP</font></a>
								<ul>
									<li><a href="grplogisticshow.php"><font size="4">- Urgently order Show</font></a></li>
									<li><a href="grplogisticsearch.php"><font size="4">- Urgently order Search</font></a></li>
								</ul>
							</li>
						</ul>
					</li>
					<li class="top"><a href="logisticmenu.php" class="top_link"><span class="down"><font size="4">Oversea order</font></span></a>
						<ul class="sub">
							<li><a href="#" class="fly"><font size="4">- Oversea order GW</font></a>
								<ul>
									<li><a href="overseaaddgw.php"><font size="4">- Oversea order add</font></a></li>
									<li><a href="overseashowgw.php"><font size="4">- Oversea order Show</font></a></li>
								</ul>
							</li>
							<li><a href="#" class="fly"><font size="4">- Oversea order GRP</font></a>
								<ul>
									<li><a href="overseaaddgrp.php"><font size="4">- Oversea order add</font></a></li>
									<li><a href="overseashowgrp.php"><font size="4">- Oversea order Show</font></a></li>
								</ul>
							</li>
							<li><a href="#" class="fly"><font size="4">- Oversea order non-stock</font></a>
								<ul>
									<li><a href="overseaaddnon.php"><font size="4">- Oversea order add</font></a></li>
									<li><a href="overseashownon.php"><font size="4">- Oversea order Show</font></a></li>
								</ul>
							</li>
							<li><a href="#" class="fly"><font size="4">- Oversea order export</font></a>
								<ul>
									<li><a href="overseaaddex.php"><font size="4">- Oversea order add</font></a></li>
									<li><a href="overseashowex.php"><font size="4">- Oversea order Show</font></a></li>
								</ul>
							</li>
						</ul>
					</li>
					<li class="top"><a href="logisticmenu.php" class="top_link"><span class="down"><font size="4">Experiment</font></span></a>
						<ul class="sub">
							<li><a href="#" class="fly"><font size="4">-  ทดลองวัตถุดิบ</font></a>
								<ul>
									<li><a href="rm lgs add 1.php"><font size="4">- Add list</font></a></li>
									<li><a href="rm lgs show 1.php"><font size="4">- Show list</font></a></li>
									<li><a href="blank form 1.php"><font size="4">- Blank form</font></a></li>
								</ul>
							</li>
							<li><a href="#" class="fly"><font size="4">- ทดลองวัสดุส่งเสริมการผลิต</font></a>
								<ul>
									<li><a href="rm lgs add 2.php"><font size="4">- Add list</font></a></li>
									<li><a href="rm lgs show 2.php"><font size="4">- Show list</font></a></li>
									<li><a href="blank form 2.php"><font size="4">- Blank form</font></a></li>
								</ul>
							</li>
						</ul>
					</li>
					<li class="top"><a href="logout.php" class="top_link"><span><font size="4">Logout</font></span></a></li>
				</ul>
			</td>
		</tr>
	</table>
	<?
		$date = date('m/d');
		$year = date('Y');
		$dateday = date("d/m",strtotime($date));
		$datestr = $dateday."/".$year;
	?>
	<p>
	<form action="overseaaddgw.php" name="frmAdd" id="frmAdd" method="post">
		<b><font face="arial,tahoma,impact" size="2">จำนวนรายการที่ต้องการสั่งซื้อ : </font></b> 
		<select name="menu1" onChange="MM_jumpMenu('parent',this,0)">		
		<?
			$i=1;
			for($i=1;$i<=10;$i++){
				if($_GET["Line"] == $i){
					$sel = "selected";
				}else{
					$sel = "";
				}
		?>
		<option value="<?=$_SERVER["PHP_SELF"];?>?Line=<?=$i;?>" <?=$sel;?>><?=$i;?></option>		
		<?
			}
		?>
		</select>	
		<p>
		<table border="0" cellspacing="2" cellpadding="2" width="5100">
			<tr height="30">
				<th bgcolor="#0066ff" align="center" rowspan="2" width="75"><font size="2" color="">Date</font></th>
				<th bgcolor="#0066ff" align="center" rowspan="2" width="75"><font size="2" color="">No.</font></th>
				<th bgcolor="#0066ff" align="center" colspan="4"><font size="2" color="">PR</font></th>
				<th bgcolor="#0066ff" align="center" colspan="2"><font size="2" color="">PO SAP</font></th>
				<th bgcolor="#0066ff" align="center" colspan="2"><font size="2" color="">PO SCT</font></th>
				<th bgcolor="#0066ff" align="center" rowspan="2" width="100"><font size="2" color="">STOCK NUMBER</font></th>
				<th bgcolor="#0066ff" align="center" rowspan="2" width="250"><font size="2" color="">รายการ</font></th>
				<th bgcolor="#0066ff" align="center" colspan="2"><font size="2" color="">ปริมาณสั่งซื้อ</font></th>
				<th bgcolor="#0066ff" align="center" rowspan="2" width="75"><font size="2" color="">ราคา/หน่วย</font></th>
				<th bgcolor="#0066ff" align="center" rowspan="2" width="75"><font size="2" color="">ราคารวม</font></th>
				<th bgcolor="#0066ff" align="center" rowspan="2" width="75"><font size="2" color="">สกุลเงิน</font></th>
				<th bgcolor="#0066ff" align="center" rowspan="2" width="75"><font size="2" color="">Exchange</font></th>
				<th bgcolor="#0066ff" align="center" rowspan="2" width="75"><font size="2" color="">ราคารวม (บาท)</font></th>
				<th bgcolor="#0066ff" align="center" rowspan="2" width="200"><font size="2" color="">PAYMENT</font></th>
				<th bgcolor="#0066ff" align="center" colspan="2"><font size="2" color="">INCOTERM</font></th>
				<th bgcolor="#0066ff" align="center" rowspan="2" width="75"><font size="2" color="">MOLD OF SHIPMENT</font></th>
				<th bgcolor="#0066ff" align="center" rowspan="2" width="100"><font size="2" color="">ETD Date</font></th>
				<th bgcolor="#0066ff" align="center" rowspan="2" width="100"><font size="2" color="">ETA Date</font></th>
				<th bgcolor="#0066ff" align="center" rowspan="2" width="200"><font size="2" color="">ชื่อผู้ขาย</font></th>
				<th bgcolor="#66ff00" align="center" colspan="2"><font size="2" color="">SHIPPING NOTIFICATION</font></th>
				<th bgcolor="#66ff00" align="center" rowspan="2" width="75"><font size="2" color="">ใบขนขาเข้า</font></th>
				<th bgcolor="#66ff00" align="center" rowspan="2" width="100"><font size="2" color="">ETD Date</font></th>
				<th bgcolor="#66ff00" align="center" rowspan="2" width="100"><font size="2" color="">ETA Date</font></th>
				<th bgcolor="#66ff00" align="center" rowspan="2" width="100"><font size="2" color="">กำหนดการถึงโรงงาน</font></th>
				<th bgcolor="#66ff00" align="center" rowspan="2" width="250"><font size="2" color="">บันทึกการติดตาม หรือ การเปลี่ยนแปลง</font></th>
				<th bgcolor="#66ff00" align="center" rowspan="2" width="75"><font size="2" color="">จำนวนรับ</font></th>
				<th bgcolor="#66ff00" align="center" rowspan="2" width="75"><font size="2" color="">ยอดคงเหลือ</font></th>
				<th bgcolor="#ffff00" align="center" rowspan="2" width="75"><font size="2" color="">FREIGHT</font></th>
				<th bgcolor="#ffff00" align="center" rowspan="2" width="75"><font size="2" color="">Exchange</font></th>
				<th bgcolor="#ffff00" align="center" rowspan="2" width="75"><font size="2" color="">FREIGHT (บาท)</font></th>
				<th bgcolor="#ffff00" align="center" rowspan="2" width="75"><font size="2" color="">ประกัน</font></th>
				<th bgcolor="#ffff00" align="center" rowspan="2" width="100"><font size="2" color="">วันนำเข้า</font></th>
				<th bgcolor="#ffff00" align="center" colspan="2"><font size="2" color="">ภาษีนำเข้า</font></th>
				<th bgcolor="#ffff00" align="center" rowspan="2" width="75"><font size="2" color="">พิกัด/อัตรา</font></th>
				<th bgcolor="#ffff00" align="center" rowspan="2" width="75"><font size="2" color="">พิธีการ</font></th>
				<th bgcolor="#ffff00" align="center" rowspan="2" width="75"><font size="2" color="">SCT</font></th>
				<th bgcolor="#ffff00" align="center" rowspan="2" width="75"><font size="2" color="">Inland</font></th>
				<th bgcolor="#ffff00" align="center" rowspan="2" width="75"><font size="2" color="">คชจ. อื่นๆ</font></th>
				<th bgcolor="#ffff00" align="center" rowspan="2" width="75"><font size="2" color="">ราคารวม (บาท)</font></th>
				<th bgcolor="#ffff00" align="center" rowspan="2" width="75"><font size="2" color="">ราคา/Unit (บาท)</font></th>
			</tr>
			<tr height="30">
				<th bgcolor="#0066ff" align="center" width="75"><font size="2" color="">เลขที่</font></th>
				<th bgcolor="#0066ff" align="center" width="100"><font size="2" color="">วันที่</font></th>
				<th bgcolor="#0066ff" align="center" width="100"><font size="2" color="">วันที่ต้องการ</font></th>
				<th bgcolor="#0066ff" align="center" width="100"><font size="2" color="">จัดหารับวันที่</font></th>
				<th bgcolor="#0066ff" align="center" width="75"><font size="2" color="">เลขที่</font></th>
				<th bgcolor="#0066ff" align="center" width="100"><font size="2" color="">วันที่</font></th>
				<th bgcolor="#0066ff" align="center" width="75"><font size="2" color="">เลขที่</font></th>
				<th bgcolor="#0066ff" align="center" width="100"><font size="2" color="">วันที่</font></th>
				<th bgcolor="#0066ff" align="center" width="75"><font size="2" color="">จำนวน</font></th>
				<th bgcolor="#0066ff" align="center" width="75"><font size="2" color="">หน่วยนับ</font></th>
				<th bgcolor="#0066ff" align="center" width="75"><font size="2" color="">TERM</font></th>
				<th bgcolor="#0066ff" align="center" width="75"><font size="2" color="">PORT</font></th>
				<th bgcolor="#66ff00" align="center" width="100"><font size="2" color="">วันที่</font></th>
				<th bgcolor="#66ff00" align="center" width="75"><font size="2" color="">เลขที่</font></th>
				<th bgcolor="#ffff00" align="center" width="50"><font size="2" color="">%</font></th>
				<th bgcolor="#ffff00" align="center" width="50"><font size="2" color="">มูลค่า</font></th>
			</tr>
		<?
		$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
		$objDB = mysql_select_db("sfg");
		$strSQL = "SELECT * FROM dataoverseaGW";
		$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
		$Num_Rows = mysql_num_rows($objQuery);
		$Num = $Num_Rows;
		$line = $_GET["Line"];
		if($line == 0){
			$line=1;
		}
		for($i=1;$i<=$line;$i++){
			$txt = "GW";
			$Num2=$Num+$i;
			$Num3=sprintf("%04d", $Num2);
			$number=$txt.$Num3;
		?>
			<tr bgcolor="#66ffff">
				<td><div align="center"><font size="2" color=""><?echo "$datestr"?></font></div></td>
				<td><div align="center"><font size="2" color=""><?echo "$number"?></font></div></td>
				<td><div align="left"><input type="text" name="txtPRnum<?=$i;?>" size="8" value=""></div></td>
				<td><div align="left">
					<input type="text" name="txtPRdate<?=$i;?>" id="txtPRdate<?=$i;?>" size="8">
						<script language="JavaScript">
							new tcal ({'formname': 'frmAdd','controlname': 'txtPRdate<?=$i;?>'});
						</script>
					</div>
				</td>
				<td><div align="left">
					<input type="text" name="txtPRdatew<?=$i;?>" size="8">
						<script language="JavaScript">
							new tcal ({'formname': 'frmAdd','controlname': 'txtPRdatew<?=$i;?>'});
						</script>
					</div>
				</td>
				<td><div align="left">
					<input type="text" name="txtPRget<?=$i;?>" size="8">
						<script language="JavaScript">
							new tcal ({'formname': 'frmAdd','controlname': 'txtPRget<?=$i;?>'});
						</script>
					</div>
				</td>
				<td><div align="left"><input type="text" name="txtPOnum<?=$i;?>" size="8"></div></td>
				<td><div align="left">
					<input type="text" name="txtPOdate<?=$i;?>" size="8">
						<script language="JavaScript">
							new tcal ({'formname': 'frmAdd','controlname': 'txtPOdate<?=$i;?>'});
						</script>
					</div>
				</td>
				<td><div align="left"><input type="text" name="txtPOSCTnum<?=$i;?>" size="8"></div></td>
				<td><div align="left">
					<input type="text" name="txtPOSCTdate<?=$i;?>" size="8">
						<script language="JavaScript">
							new tcal ({'formname': 'frmAdd','controlname': 'txtPOSCTdate<?=$i;?>'});
						</script>
					</div>
				</td>
				<td><div align="left">
					<select name="txtSTnum<?=$i;?>" OnChange="resutName(this.value);">
						<option value="" selected>---</option>
						<?
						$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
						$objDB = mysql_select_db("sfg");
						$strSQL = "SELECT * FROM datamaterialgw ORDER BY STnum ASC";
						$objQuery = mysql_query($strSQL);
						while($objResult = mysql_fetch_array($objQuery)){
						?>
							<option value="<?=$objResult["STnum"];?>"><?=$objResult["STnum"];?></option>
						<?
						}
						?>
					</select>
					</div>
				</td>
				<td><div align="left"><input type="text" name="txtlist<?=$i;?>" size="40"></div></td> <!--ไม่รู้ว่าแก้ตรงนี้รึปล่าวเพราะผมเอา <?=$i;?> ใช้ได้แต่มันจะ add แบบหลายบรรทัดไม่ได้-->
				<td><div align="left"><input type="text" name="txtordernum<?=$i;?>" size="8" onkeyup="fncCal(this.value);" id="txtordernum"></div></td>
				<td><div align="left"><select name="txtorderunit<?=$i;?>">
					<option value="" selected>---</option>
					<option value="kgs">kgs</option>
					<option value="m">m</option>
					<option value="PC">PC</option>
					<option value="roll">roll</option>
					<option value="set">set</option>
					<option value="sq.m">sq.m</option>
					<option value="unit">unit</option>
				</select></div></td>
				<td><div align="left"><input type="text" name="txtPU<?=$i;?>" size="8" onkeyup="fncCal(this.value);" id="txtPU"></div></td>
				<td><div align="left"><input type="text" name="txtPT<?=$i;?>" size="8" onkeyup="fncCal3(this.value);" id="txtPT"></div></td>
				<td><div align="left"><select name="txtmonetary<?=$i;?>">
					<option value="" selected>---</option>
					<option value="USD">USD</option>
					<option value="EUR">EUR</option>
					<option value="AUD">AUD</option>
					<option value="JPY">JPY</option>
					<option value="NOK">NOK</option>
					<option value="NZD">NZD</option>
				</select></div></td>
				<td><div align="left"><input type="text" name="txtExchange<?=$i;?>" size="8" onkeyup="fncCal3(this.value);" id="txtExchange"></div></td>
				<td><div align="left"><input type="text" name="txtThaibath<?=$i;?>" size="8" onkeyup="fncCal2(this.value);" id="txtThaibath"></div></td>
				<td><div align="left"><input type="text" name="txtpayment<?=$i;?>" size="30"></div></td>
				<td><div align="left"><input type="text" name="txtterm<?=$i;?>" size="8"></div></td>
				<td><div align="left"><input type="text" name="txtport<?=$i;?>" size="8"></div></td>
				<td><div align="left"><select name="txtMOS<?=$i;?>">
					<option value="" selected>---</option>
					<option value="Sea">Sea</option>
					<option value="Air">Air</option>
					<option value="Courier">Courier</option>				
				</div></td>
				<td><div align="left">
					<input type="text" name="txtETDdate<?=$i;?>" size="8">
						<script language="JavaScript">
							new tcal ({'formname': 'frmAdd','controlname': 'txtETDdate<?=$i;?>'});
						</script>
					</div>
				</td>
				<td><div align="left">
					<input type="text" name="txtETAdate<?=$i;?>" size="8">
						<script language="JavaScript">
							new tcal ({'formname': 'frmAdd','controlname': 'txtETAdate<?=$i;?>'});
						</script>
					</div>
				</td>
				<td><div align="left"><input type="text" name="txtname<?=$i;?>" size="30"></div></td>
				<td><div align="left">
					<input type="text" name="txtshippingdate<?=$i;?>" size="8">
						<script language="JavaScript">
							new tcal ({'formname': 'frmAdd','controlname': 'txtshippingdate<?=$i;?>'});
						</script>
					</div>
				</td>
				<td><div align="left"><input type="text" name="txtshippingnum<?=$i;?>" size="10"></div></td>
				<td><div align="left"><input type="text" name="txtimport<?=$i;?>" size="10"></div></td>
				<td><div align="left">
					<input type="text" name="txtETDdate2<?=$i;?>" size="8">
						<script language="JavaScript">
							new tcal ({'formname': 'frmAdd','controlname': 'txtETDdate2<?=$i;?>'});
						</script>
					</div>
				</td>
				<td><div align="left">
					<input type="text" name="txtETAdate2<?=$i;?>" size="8">
						<script language="JavaScript">
							new tcal ({'formname': 'frmAdd','controlname': 'txtETAdate2<?=$i;?>'});
						</script>
					</div>
				</td>
				<td><div align="left">
					<input type="text" name="txtprogram<?=$i;?>" size="8">
						<script language="JavaScript">
							new tcal ({'formname': 'frmAdd','controlname': 'txtprogram<?=$i;?>'});
						</script>
					</div>
				</td>
				<td><div align="left"><input type="text" name="txtnote<?=$i;?>" size="40"></div></td>
				<td><div align="left"><input type="text" name="txtnum<?=$i;?>" size="8" onkeyup="fncCal4(this.value);" id="txtnum"></div></td>
				<td><div align="left"><input type="text" name="txtremain<?=$i;?>" size="8"></div></td>
				<td><div align="left"><input type="text" name="txtfreight<?=$i;?>" size="8" onkeyup="fncCal5(this.value);" id="txtfreight"></div></td>
				<td><div align="left"><input type="text" name="txtExchange2<?=$i;?>" size="8" onkeyup="fncCal5(this.value);" id="txtExchange2"></div></td>
				<td><div align="left"><input type="text" name="txtThaibath2<?=$i;?>" size="8" onkeyup="fncCal2(this.value);" id="txtThaibath2"></div></td>
				<td><div align="left"><input type="text" name="txtinsurance<?=$i;?>" size="8" onkeyup="fncCal2(this.value);" id="txtinsurance"></div></td>
				<td><div align="left">
					<input type="text" name="txtimportdate<?=$i;?>" size="8">
						<script language="JavaScript">
							new tcal ({'formname': 'frmAdd','controlname': 'txtimportdate<?=$i;?>'});
						</script>
					</div>
				</td>
				<td><div align="left"><input type="text" name="txtpersen<?=$i;?>" size="8"></div></td>
				<td><div align="left"><input type="text" name="txtvalue<?=$i;?>" size="8" onkeyup="fncCal2(this.value);" id="txtvalue"></div></td>
				<td><div align="left"><input type="text" name="txtrate<?=$i;?>" size="8"></div></td>
				<td><div align="left"><input type="text" name="txtritual<?=$i;?>" size="8" onkeyup="fncCal2(this.value);" id="txtritual"></div></td>
				<td><div align="left"><input type="text" name="txtSCT<?=$i;?>" size="8" onkeyup="fncCal2(this.value);" id="txtSCT"></div></td>
				<td><div align="left"><input type="text" name="txtinland<?=$i;?>" size="8" onkeyup="fncCal2(this.value);" id="txtinland"></div></td>
				<td><div align="left"><input type="text" name="txtother<?=$i;?>" size="8" onkeyup="fncCal2(this.value);" id="txtother"></div></td>
				<td><div align="left"><input type="text" name="txtinclud<?=$i;?>" size="8" onkeyup="fncCal4(this.value);" id="txtinclud" ></div></td>
				<td><div align="left"><input type="text" name="txtPU2<?=$i;?>" id="txtPU2" size="8"></div></td>
			</tr>		
		<?
		}
		?>
		</table>		
		<br>
		<input type="submit" name="submit" value="submit">
		<input type="hidden" name="hdnLine" value="<?=$i;?>">
		<hr width="5100">
		<a href="logout.php"><font face="arial,tahoma,impact" size="1" color=""><b>Logout >></b></font></a>
		<a href="logisticmenu.php"><font face="arial,tahoma,impact" size="1" color=""><b>Menu >></b></font></a>
		<a href="overseaaddgw.php"><font face="arial,tahoma,impact" size="1" color=""><b>Add oversea order GW</b></font></a>
		<hr width="5100">
		</div>
		<b><font face="arial,tahoma,impact" size="1" color="#3a3a3a">Logistic Dep.</font></b><br>
		<b><font face="arial,tahoma,impact" size="1" color="#3a3a3a">Siam Fiberglass Co.Ltd</font></b><br>
		<b><font face="arial,tahoma,impact" size="1" color="#3a3a3a">39 Moo 9, Nangplakradi Road Nongpling, Nongkhae, Saraburi 18140</font></b><br>
		<b><font face="arial,tahoma,impact" size="1" color="#3a3a3a"><u>Tel</u> : +6636-373-441-4 #300 	<u>Fax</u> : +6636-373-264</font></b><br>
		<hr width="5100">
	</form>	
	<?
		$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
		$objDB = mysql_select_db("sfg");		
		for($i=1;$i<=$_POST["hdnLine"];$i++){
			$txt = "GW";
			$Num2=$Num+$i;
			$Num3=sprintf("%04d", $Num2);
			$number=$txt.$Num3;
			$num1=$_POST["txtPT$i"];
			$decimal1=number_format($num1, 2, '.', '');
			$num2=$_POST["txtThaibath$i"];
			$decimal2=number_format($num2, 2, '.', '');
			$num3=$_POST["txtThaibath2$i"];
			$decimal3=number_format($num3, 2, '.', '');
			$num4=$_POST["txtinclud$i"];
			$decimal4=number_format($num4, 2, '.', '');
			$num5=$_POST["txtPU2$i"];
			$decimal5=number_format($num5, 2, '.', '');
			if($_POST["txtPRnum$i"] != ""){
				$strSQL = "INSERT INTO dataoverseagw ";
				$strSQL .="(Date,Number,PRnum,PRdate,PRdatew,PRget,POnum,POdate, POSCTnum,POSCTdate,STnum,list,ordernum,orderunit,PU,PT,monetary, Exchange,Thaibath,payment,MOS,ETDdate,ETAdate,name,shippingnum ,shippingdate,import,ETDdate2,ETAdate2,program,note,num,remain,term ,port,freight,Exchange2,Thaibath2,insurance,importdate,persen,value, rate,ritual,SCT,inland,other,includ,PU2)";
				$strSQL .="VALUES ";
				$strSQL .="('".$datestr."','".$number."','".$_POST["txtPRnum$i"]."' ,'".$_POST["txtPRdate$i"]."','".$_POST["txtPRdatew$i"]."','".$_POST["txtPRget$i"]."' ,'".$_POST["txtPOnum$i"]."','".$_POST["txtPOdate$i"]."','".$_POST["txtPOSCTnum$i"]."','".$_POST["txtPOSCTdate$i"]."', '".$_POST["txtSTnum$i"]."','".$_POST["txtlist$i"]."','".$_POST["txtordernum$i"]."' ,'".$_POST["txtorderunit$i"]."','".$_POST["txtPU$i"]."','".$decimal1."','".$_POST["txtmonetary$i"]."', '".$_POST["txtExchange$i"]."','".$decimal2."','".$_POST["txtpayment$i"]."','".$_POST["txtMOS$i"]."', '".$_POST["txtETDdate$i"]."','".$_POST["txtETAdate$i"]."','".$_POST["txtname$i"]."', '".$_POST["txtshippingnum$i"]."','".$_POST["txtshippingdate$i"]."','".$_POST["txtimport$i"]."', '".$_POST["txtETDdate2$i"]."','".$_POST["txtETAdate2$i"]."','".$_POST["txtprogram$i"]."', '".$_POST["txtnote$i"]."','".$_POST["txtnum$i"]."','".$_POST["txtremain$i"]."','".$_POST["txtterm$i"]."', '".$_POST["txtport$i"]."','".$_POST["txtfreight$i"]."','".$_POST["txtExchange2$i"]."','".$decimal3."' ,'".$_POST["txtinsurance$i"]."','".$_POST["txtimportdate$i"]."','".$_POST["txtpersen$i"]."' ,'".$_POST["txtvalue$i"]."','".$_POST["txtrate$i"]."','".$_POST["txtritual$i"]."' ,'".$_POST["txtSCT$i"]."','".$_POST["txtinland$i"]."','".$_POST["txtother$i"]."','".$decimal4."','".$decimal5."')";
				$objQuery = mysql_query($strSQL);
			}
		}
		mysql_close($objConnect);
	?>
</body>
</html>





Tag : PHP, MySQL







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-08-30 11:33:34 By : prapakorn View : 1184 Reply : 2
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ผมเคยเขียนไว้ในนี้น่ะครับ



Go to : การนำ jQuery มาทำ AutoFill ข้อมูล Textbox และการตรวจสอบข้อมูลซ้ำด้วย Ajax






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-08-30 13:26:40 By : mr.win
 


 

No. 2



โพสกระทู้ ( 48 )
บทความ ( 0 )



สถานะออฟไลน์


ผมลองแปลงจาก text box เป็น list menu ในช่อง CustomerID มันไม่ยอม search ให้น่ะครับ พี่วินพอจะมีแนวทางไหมครับ ขอบคุณครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-08-30 14:24:25 By : prapakorn
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยดู code ให้หน่อยครับว่ามันผิดตรงไหน ผมทำ list menu ที่ดึงข้อมูลมาจาก database แต่ข้อมูลมันไม่ Auto fill ให้ครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่