|
|
|
เว็บพอขึ้นโฮสจริงมีปัญหาข้อมูลไม่มาแต่มาเป็น script |
|
|
|
|
|
|
|
รันแบบไหนครับ เอา Code มาดูด้วยครับ
|
|
|
|
|
Date :
2013-02-08 08:55:40 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?php
$host="localhost";
$username="prooie"; // username connect db
$pass_word ="oiepro01";
error_reporting(0);
// connect database
$objConnect = mysql_connect( $host,$username,$pass_word) or die ("เธ•เธดเธ”เธ•เนเธญ Mysql เนเธกเนเนเธ”เน ");
mysql_query("SET NAMES utf8");
mysql_select_db("factory");
$tt = "SELECT * FROM factory, map_fac_isic WHERE (factory.factory_id = map_fac_isic.factory_id) AND (factory.factory_id = '$_GET[fac_id]') ";
$tt2 = "SELECT * FROM map_fac_isic, std_isic, std_unit WHERE ( std_unit.unit_id = std_isic.unit_id) AND ( std_isic.isic = map_fac_isic.isic) AND (map_fac_isic.factory_id = '$_GET[fac_id]') ";
$tt4 = "SELECT * FROM map_fac_isic, std_material, std_unit WHERE ( std_unit.unit_id = std_material.unit_id) AND ( std_material.isic = map_fac_isic.isic) AND (map_fac_isic.factory_id = '$_GET[fac_id]') ";
mysql_query("set NAMES utf8");
mysql_query("SET character_set_results='utf8'") ;
$result = mysql_query($tt);
$numFound = mysql_num_rows($result);
$record = mysql_fetch_array($result);
$result2 = mysql_query($tt2);
$numFound2 = mysql_num_rows($result2);
$numProduct = $numFound2;
//Create unit list command for javascript
$unitList = "SELECT unit_id, unit_name FROM std_unit ";
$resultUnitList = mysql_query($unitList);
$count = 0;
while($unitInfo = mysql_fetch_array($resultUnitList)){
$U_name = iconv("utf8","utf-8",$unitInfo['unit_name']);
$U_id = $unitInfo['unit_id'];
$listUnitForJava = $listUnitForJava."<option value='" .$U_id. "' selected='selected'>".$U_name."</option> ";
$conut++;
}
$count = 0;
$result4 = mysql_query($tt4);
$numFound4 = mysql_num_rows($result4);
/*$record2 = mysql_fetch_array($result2);*/
$c1 =1;
?>
</p>
<div class="head">
<p>โครงการพัฒนาการจัดทำดัชนีอุตสาหกรรมและการบริการ</p>
</div>
<p> </p>
<form id="form1" name="form1" method="post" action = "Insert.php">
<table width="851" border="0">
<tr>
<td width="171"><div align="right">ชื่อผู้กรอก</div></td>
<td colspan="3"><input type="text" name="txtName" id="txtName" /></td>
</tr>
<tr>
<td><div align="right">ชื่อโรงงาน </div></td>
<td colspan="3"><input name="txtFacName" type="text" disabled="disabled" size = 100 id="txtFacName" value="<?=$record['factory_name']; ?>" /></td>
</tr>
<tr>
<td><div align="right">ทะเบียนโรงงาน </div></td>
<td width="234"><input name="txtFacCode" type="text" disabled="disabled" id="txtFacCode" value="<?=$record['factory_code'];?>" /></td>
<td width="149"><div align="right">รหัสโรงงาน</div></td>
<td width="279"><input name="txtFacID" type="text" id="txtFacID" value="<?=$record['factory_id'];?>" /></td>
</tr>
<tr>
<td><div align="right">ISIC Code</div></td>
<td><input name="txtISIC" type="text" disabled="disabled" id="txtISIC" value="<?=$record['isic']; ?>" maxlength="4" /></td>
<td><div align="right">เลขที่แบบสอบถาม</div></td>
<td><input name="txtNo" type="text" id="txtNo" value="<?=$record['isic']; ?>"/></td>
</tr>
<tr>
<td><div align="right">ที่อยู่</div></td>
<td colspan="3"><input name="txtAdd" type="text" size = 100 disabled="disabled" id="txtAdd" /></td>
</tr>
<tr>
<td><div align="right">โทรศัพท์</div></td>
<td><input name="txtPhone" type="text" disabled="disabled" id="txtPhone" value="<?=$record['telno']; ?>" /></td>
<td><div align="right">โทรสาร</div></td>
<td><input name="txtFax" type="text" disabled="disabled" id="txtFax" value="<?=$record['faxno']; ?>"/></td>
</tr>
<tr>
<td><div align="right">สำหรับเดือน</div></td>
<td><select name="lstMonth" size="1" id="lstMonth">
<option value="1" selected="selected">มกราคม</option>
<option value="2">กุมภาพันธ์</option>
<option value="3">มีนาคม</option>
<option value="4">เมษายน</option>
<option value="5">พฤษภาคม</option>
<option value="6">มิถุนายน</option>
<option value="7">กรกฏาคม</option>
<option value="8">สิงหาคม</option>
<option value="9">กันยายน</option>
<option value="10">ตุลาคม</option>
<option value="11">พฤศจิกายน</option>
<option value="12">ธันวาคม</option>
</select></td>
<td><div align="right">พ.ศ. </div></td>
<td><input name="txtYear" type="text" id="txtYear" /></td>
</tr>
</table>
<p> </p>
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup">
<li class="TabbedPanelsTab" tabindex="0">1. สินค้า (จำนวน)</li>
<li class="TabbedPanelsTab" tabindex="0">2. สินค้าสำเร็จรูป (มูลค่า)</li>
<li class="TabbedPanelsTab" tabindex="0">3. แรงงาน</li>
<li class="TabbedPanelsTab" tabindex="0">4. วัตถุดิบ</li>
<li class="TabbedPanelsTab" tabindex="0">5. ความเห็นต่อภาวะธุรกิจ </li>
</ul>
<div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent">
<p> </p>
<div class="TabbedPanelsContent">
<table id="myTbl2" width="1300" border="0" align="center">
<tr class="table-center">
<td width="10"> </td>
<td width="40"><strong>No.</strong></td>
<td width="800"><strong>สินค้าที่สำรวจ</strong></td>
<td width="50"><strong>รหัส</strong></td>
<td width="50"><strong>หน่วย</strong></td>
<td width="80"><strong>สินค้าคงคลัง <br /> ณ ต้นเดือน</strong></td>
<td width="80"><strong>การผลิต <br /> *1 </strong></td>
<td width="80"><strong>สินค้ารับมา<br />
*2</strong></td>
<td width="80"><strong>การจำหน่าย <br /> ในประเทศ</strong></td>
<td width="80"><strong>การจำหน่าย <br /> ส่งออก</strong></td>
<td width="80"><strong>การจำหน่าย <br /> อื่นๆ</strong></td>
<td width="80"><strong>สินค้าคงคลัง <br /> ณ สินเดือน</strong></td>
<td width="120"><strong>กำลังการผลิต <br /> ต่อเดือน *4</strong></td>
</tr>
<?php
while($record2 = mysql_fetch_array($result2))
{
echo "<tr>";
echo "<td> </td>";
echo "<td>".$c1."</td>";
echo "<td><span class=\"table-center\">
<input name=\"textfield23[]\" type=\"text\" id=\"textfield23[]\" readonly=\"readonly\" size = \" 50 \" value=\"".$record2['mat_thai_name']."\"/> </span></td>";
echo "<td><span class=\"table-center\">
<input name=\"textfield24[]\" type=\"text\" id=\"textfield24[]\" readonly=\"readonly\" size = \" 1\" value=\"".$record2['commodity_code']."\"/></span></td>";
echo "<td><span class=\"table-center\">
<input name=\"textfield25[]\" type=\"text\" id=\"textfield25[]\" readonly=\"readonly\" size = \" 1 \" value=\"".$record2['unit_name']."\"/></span></td>";
echo "<td> <span class=\"table-center\">
<input name=\"textfield26[]\" type=\"text\" id=\"textfield26[]\" value=\"\" size=\"10\" />
</span></td>";
echo "<td> <span class=\"table-center\">
<input name=\"textfield27[]\" type=\"text\" id=\"textfield27[]\" value=\"\" size=\"10\" />
</span></td>";
echo "<td> <span class=\"table-center\">
<input name=\"textfield28[]\" type=\"text\" id=\"textfield28[]\" value=\"\" size=\"10\" />
</span></td>";
echo "<td> <span class=\"table-center\">
<input name=\"textfield29[]\" type=\"text\" id=\"textfield29[]\" value=\"\" size=\"10\" />
</span></td>";
echo "<td> <span class=\"table-center\">
<input name=\"textfield30[]\" type=\"text\" id=\"textfield30[]\" value=\"\" size=\"10\" />
</span></td>";
echo "<td> <span class=\"table-center\">
<input name=\"textfield31[]\" type=\"text\" id=\"textfield31[]\" value=\"\" size=\"10\" />
</span></td>";
echo "<td> <span class=\"table-center\">
<input name=\"textfield32[]\" type=\"text\" id=\"textfield32[]\" value=\"\" size=\"10\" />
</span></td>";
echo "<td> <span class=\"table-center\">
<input name=\"textfield33[]\" type=\"text\" id=\"textfield33[]\" value=\"\" size=\"10\" />
</span></td>";
echo "</tr>";
$c1 = $c1+1;
}
?>
</table>
<br />
</div>
<a href='javascript:addProduct()'>เพิ่มสินค้า</a>
<table id="text">
<tr></tr>
</table>
<script type= "text/javascript" >
function addProduct()
{
var m = document.getElementById('text').rows.length;
var t =<?php echo json_encode($listUnitForJava); ?>;
//alert(m);
fields = 0;
document.getElementById('text').innerHTML += "\r\n<table width='1300' border='0' align='center'><tr class='table-center'><td width='10'> </td><td width='40'></td><td width='800'><span class='table-center'> <input name='textfield23[]' type='text' id='textfield23[]' size = '50' onblur = setNameOther(this.value,"+m+") /> </span></td><td width='50'><span class='table-center'><input name='textfield24[]' type='text' id='textfield24[]' readonly='readonly' value = '099' size = ' 1'/></span></td><td width='50'><span class='table-center'><select name='lstUnit1[]' size='1' id='lstUnit1[]' ></span>"+t+"</td><td width='80'><span class='table-center'><input name='textfield26[]' type='text' id='textfield26[]' size='10' /></span></td><td width='80'><span class='table-center'><input name='textfield27[]' type='text' id='textfield27[]' size='10' /></span></td><td width='80'><span class='table-center'><input name='textfield28[]' type='text' id='textfield28[]'size='10' /></span></td><td width='80'><span class='table-center'><input name='textfield29[]' type='text' id='textfield29[]'size='10' /></span></td><td width='80'><span class='table-center'><input name='textfield30[]' type='text' id='textfield30[]'size='10' /></span></td><td width='80'><span class='table-center'><input name='textfield31[]' type='text' id='textfield31[]'size='10' /></span></td><td width='80'><span class='table-center'><input name='textfield32[]' type='text' id='textfield32[]'size='10' /></span></td><td width='120'><span class='table-center'><input name='textfield33[]' type='text' id='textfield33[]'size='10' /></span></td></tr></table>";
var name = 'otherPro_'+m;
var nameListUnit = 'lstUnit2'+m;
//alert(name);
document.getElementById('text2').innerHTML += "<table width='1100' border='0' align='center'><tr class='table-center'><td width='10'> </td><td width='40'></td><td width='262'><span class='table-center'> <input name='"+name+"' type='text' readonly = 'readonly' id='textfield34[]' size = '50' /> </span></td><td width='50'><span class='table-center'><input name='textfield35[]' type='text' id='textfield35[]' readonly='readonly' value = '099' size = '20'/></span></td><td width='150'><span class='table-center'><td><input name='textfield36[]' type='text' id= 'textfield36[]' readonly='readonly' size = '2' value='พันบาท'></span></td></span></td><td width='120'><span class='table-center'><input name='textfield37[]' type='text' id='textfield37[]'size='10' /></span></td><td width='136'><span class='table-center'><input name='textfield38[]' type='text' id='textfield38[]' size='10' /></span></td><td width='120'><span class='table-center'><input name='textfield39[]' type='text' id='textfield39[]'size='10' /></span></td><td width='80'><span class='table-center'><input name='textfield40[]' type='text' id='textfield40[]'size='10' /></span></td></tr></table>";
}
function setNameOther(value, row){
var name = 'otherPro_'+row;
//alert(name);
document.getElementsByName(name).item(0).value = value;
//document.getElementsByName('name').item(0).value = "FFFFF";
}
function setUnit(value, row){
var name = 'lstUnit2'+row;
//alert(value);
document.getElementsByName(name).item(0).selectedIndex= value;
//document.getElementsByName('name').item(0).value = "FFFFF";
}
</script>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</div>
<div class="TabbedPanelsContent">
<p> </p>
<div class="TabbedPanelsContent">
<table id="myTbl" width="1100" border="0" align="center">
<tr class="table-center">
<td width="40"> </td>
<td width="40"><strong>No.</strong></td>
<td width="262"><strong>สินค้าที่สำรวจ</strong></td>
<td width="50"><strong>รหัส</strong></td>
<td width="50"><strong>หน่วย</strong></td>
<td width="120"><strong>การจำหน่ายรวม</strong></td>
<td width="120"><strong>ยอดสั่งซื้อเดือนนี้<br />
*5</strong></td>
<td width="136"><strong>ยอดสั่งซื้อเดือนก่อนๆ<br />
ที่ยังไม่ได้ส่งมอบ</strong></td>
<td width="120"><strong>แผนการจำหน่าย<br />
เดือนหน้า *6</strong></td>
</tr>
<?php
$result2 = mysql_query($tt2);
$c1 = 1;
while($record2 = mysql_fetch_array($result2))
{
$tt3 = "SELECT * FROM std_unit WHERE unit_id = '11'";
$result3 = mysql_query($tt3);
$record3 = mysql_fetch_array($result3);
echo "<tr>";
echo "<td> </td>";
echo "<td>".$c1."</td>";
echo "<td><input name=\"textfield34[]\" type=\"text\" id=\"textfield34[]\" readonly=\"readonly \" size =\"50\" value=\"".$record2['mat_thai_name']."\"/></span></td>";
echo "<td><input name=\"textfield35[]\" type=\"text\" id=\"textfield35[]\" readonly=\"readonly \" value=\"".$record2['commodity_code']."\"/></span></td>";
echo "<td><input name=\"textfield36[]\" type=\"text\" id=\"textfield36[]\" readonly=\"readonly size\" = \" 2 \" value=\"".$record3['unit_name']."\"/></span></td>";
echo "<td> <span class=\"table-center\">
<input name=\"textfield37[]\" type=\"text\" id=\"textfield37[]\" value=\"\" size=\"10\" />
</span></td>";
echo "<td> <span class=\"table-center\">
<input name=\"textfield38[]\" type=\"text\" id=\"textfield38[]\" value=\"\" size=\"10\" />
</span></td>";
echo "<td> <span class=\"table-center\">
<input name=\"textfield39[]\" type=\"text\" id=\"textfield39[]\" value=\"\" size=\"10\" />
</span></td>";
echo "<td> <span class=\"table-center\">
<input name=\"textfield40[]\" type=\"text\" id=\"textfield40[]\" value=\"\" size=\"10\" />
</span></td>";
echo "</tr>";
$c1 = $c1+1;
}
?>
</table>
<br />
</div>
<table width='1100' border='0' align='center' id="text2">
<tr></tr>
</table>
</div>
<div class="TabbedPanelsContent">
<p> </p>
<table width="800" border="0" align="center">
<tr class="table-center">
<td width="35"><strong>No.</strong></td>
<td width="359"><strong>รายการ</strong></td>
<td width="70"><strong>รหัส</strong></td>
<td width="70"><strong>หน่วย</strong></td>
<td width="120"><strong>ตัวเลขรวม<br />
ทั้งโรงงาน</strong></td>
<td width="120"><strong>สำหรับการผลิต<br />
สินค้าที่สำรวจ</strong></td>
</tr>
<tr>
<td class="table-center">1.</td>
<td>จำนวนคนงานฝ่ายผลิต</td>
<td class="table-center">01</td>
<td class="table-center">คน</td>
<td class="table-center"><label for="textfield28"></label>
<input name="textfield301" type="text" id="textfield301" size="20" /></td>
<td class="table-center"><label for="textfield302"></label>
<input name="textfield302" type="text" id="textfield29" size="20" /></td>
</tr>
<tr>
<td class="table-center">2.</td>
<td>จำนวนชั่วโมงทำงานโดยเฉลี่ย (ต่อวัน ต่อคน)</td>
<td class="table-center">02</td>
<td class="table-center">ชั่วโมง</td>
<td class="table-center"> </td>
<td class="table-center"><input name="textfield303" type="text" id="textfield303" size="20" /></td>
</tr>
<tr>
<td class="table-center">3.</td>
<td>จำนวนวันทำงานโดยเฉลี่ย</td>
<td class="table-center">03</td>
<td class="table-center">วัน</td>
<td class="table-center"> </td>
<td class="table-center"><label for="textfield302"></label>
<input name="textfield304" type="text" id="textfield304" size="20" /></td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</div>
<div class="TabbedPanelsContent">
<p> </p>
<div class="TabbedPanelsContent">
<table width="1000" height="179" border="2" align="center">
<tr class="table-center">
<td width="45" rowspan="2"> </td>
<td width="45" rowspan="2" class="table-center"><strong>No.</strong></td>
<td width="256" rowspan="2" class="table-center"><strong>วัตถุดิบ</strong></td>
<td width="60" rowspan="2" class="table-center"><strong>รหัส</strong></td>
<td colspan="4"><strong> วัตถุดิบคงคลัง ณ สิ้นเดือน</strong></td>
</tr>
<tr class="table-center">
<td width="140"><strong>จำนวน</strong></td>
<td width="140"><strong>หน่วย</strong></td>
<td width="140"><strong>มูลค่า</strong></td>
<td width="140"><strong>หน่วย</strong></td>
</tr>
<?php
$result4 = mysql_query($tt4);
$c1 = 1;
while($record4 = mysql_fetch_array($result4))
{
$tt5 = "SELECT * FROM std_unit WHERE unit_id = '11'";
$result5 = mysql_query($tt5);
$record5 = mysql_fetch_array($result5);
echo "<tr>";
echo "<td> </td>";
echo "<td>".$c1."</td>";
echo "<td><span class=\"table-center\">
<input name=\"textfield401[]\" type=\"text\" id=\"textfield401[]\" readonly=\"readonly\" size = \" 50 \" value=\"".$record4['mat_thai_name']."\"/> </span></td>";
echo "<td><span class=\"table-center\">
<input name=\"textfield402[]\" type=\"text\" id=\"textfield402[]\" readonly=\"readonly\" size = \" 10 \" value=\"".$record4['mat_code']."\"/> </span></td>";
echo "<td> <span class=\"table-center\">
<input name=\"textfield403[]\" type=\"text\" id=\"textfield403[]\" size=\"20\" />
</span></td>";
echo "<td><span class=\"table-center\">
<input name=\"textfield404[]\" type=\"text\" id=\"textfield404[]\" readonly=\"readonly\" size = \" 10 \" value=\"".$record4['unit_name']."\"/> </span></td>";
echo "<td> <span class=\"table-center\">
<input name=\"textfield405[]\" type=\"text\" id=\"textfield405[]\" size=\"20\" />
</span></td>";
echo "<td><span class=\"table-center\">
<input name=\"textfield406[]\" type=\"text\" id=\"textfield406[]\" readonly=\"readonly\" size = \"10 \" value=\"".$record5['unit_name']."\"/> </span></td>";
echo "</tr>";
$c1 = $c1+1;
}
?>
</table>
</div>
<a href='javascript:addInv()'>เพิ่มรายการ</a>
<div id="otherInv">
</div>
<script type= "text/javascript" >
function addInv()
{
var t =<?php echo json_encode($listUnitForJava); ?>;
fields = 0;
document.getElementById('otherInv').innerHTML += "<center><tr><td width='45'> </td><td width='45'></td><td width='256'><span class='table-center'><input name='textfield401[]' type='text' id='textfield401[]' size='50' /></span></td><td width='60'><span class=table-center><input name='textfield402[]' type='text' id='textfield402[]' value ='099' size='10' /></span></td><td width='140'><span class='table-center'><input name='textfield403[]' type='text' id='textfield403[]' size='20'/></span></td><td width='140'><span class='table-center'><select name='lstUnit4[]' size='1' id='lstUnit4[]'></span>"+t+" </span></td><td width='140'><span class='table-center'><input name='textfield405[]' type='text' id='textfield405[]' size=20/></span></td><td width='140'><span class='table-center'><input name='textfield406[]' type='text' id='textfield401[]' size='10' value = 'พันบาท'/></span></td></tr></center>";
}
</script>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</div>
<div class="TabbedPanelsContent">
<p> </p>
<table width="800" border="0" align="center">
<tr>
<td width="199"> </td>
<td width="115" class="table-center">(1)<br />
ดีมาก</td>
<td width="115" class="table-center">(2)<br />
ดีเล็กน้อย</td>
<td width="115" class="table-center">(3)<br />
ทรงตัว</td>
<td width="115" class="table-center">(4)<br />
แย่เล็กน้อย</td>
<td width="115" class="table-center">(5)<br />
แย่มาก</td>
</tr>
<tr>
<td>เดือนนี้</td>
<td class="table-center"><input type="radio" name="RadioGroup1" value="1" id="RadioGroup1_0" /></td>
<td class="table-center"><input name="RadioGroup1" type="radio" id="RadioGroup1_1" value="2" /></td>
<td class="table-center"><input type="radio" name="RadioGroup1" value="3" id="RadioGroup1_2" /></td>
<td class="table-center"><input type="radio" name="RadioGroup1" value="4" id="RadioGroup1_3" /></td>
<td class="table-center"><input type="radio" name="RadioGroup1" value="5" id="RadioGroup1_4" /></td>
</tr>
<tr>
<td>เดือนหน้า *6</td>
<td class="table-center"><input type="radio" name="RadioGroup2" value="1" id="RadioGroup2_0" /></td>
<td class="table-center"><input type="radio" name="RadioGroup2" value="2" id="RadioGroup2_1" /></td>
<td class="table-center"><input type="radio" name="RadioGroup2" value="3" id="RadioGroup2_2" /></td>
<td class="table-center"><input type="radio" name="RadioGroup2" value="4" id="RadioGroup2_3" /></td>
<td class="table-center"><input type="radio" name="RadioGroup2" value="5" id="RadioGroup2_4" /></td> </tr>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
</div>
</div>
</div>
<p> </p>
<table width="400" border="0" align="center">
<tr>
<td width="128"> </td>
<td width="130"><div align="center">
<input type="submit" name="save" id="save" value="บันทึก" click="Insert.php"/>
</div></td>
<td width="128"> </td>
</tr>
</table>
<p>
<? mysql_close($objConnect);?>
</p>
</form>
<script type="text/javascript">
<!--
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
//-->
</script>
</body>
</html>
|
|
|
|
|
Date :
2013-02-08 10:02:04 |
By :
hanami001 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลอง declare ข้อมูลก่อนไหมคะ
$x=$objResult["x"];
ที่ form ก็ เป็น value="<? echo $x ?>"
$factory_code=$record["factory_code"];
value="<? echo $factory_code ?>"
|
|
|
|
|
Date :
2013-02-08 10:43:23 |
By :
shushu |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|