function CreateNewRow() { var intLine = parseInt(document.frmMain.hdnMaxLine.value); intLine++; var theTable = document.all.tbExp var newRow = theTable.insertRow(theTable.rows.length) newRow.id = newRow.uniqueID var item1 = 1 var newCell //*** Column 1 ***// newCell = newRow.insertCell(0) newCell.id = newCell.uniqueID newCell.setAttribute("className", "css-name"); newCell.innerHTML = "<center><input type='text' name='batch_number_"+intLine+"' style='width: 200px' class='form-control' /></center>" //*** Column 2 ***// newCell = newRow.insertCell(1) newCell.id = newCell.uniqueID newCell.setAttribute("className", "css-name"); newCell.innerHTML = "<center><input type='text' name='batch_stock_"+intLine+"' style='width: 80px' class='form-control' /></center>" //*** Column 3 ***// newCell = newRow.insertCell(2) newCell.id = newCell.uniqueID newCell.setAttribute("className", "css-name"); newCell.innerHTML = "<center><input type='text' name='batch_in_"+intLine+"' style='width: 80px' class='form-control' /></center>" //*** Column 4 ***// newCell = newRow.insertCell(3) newCell.id = newCell.uniqueID newCell.setAttribute("className", "css-name"); newCell.innerHTML = "<center><input type='text' name='batch_out_"+intLine+"' style='width: 80px' class='form-control' /></center>" //*** Column 5 ***// /* newCell = newRow.insertCell(4) newCell.id = newCell.uniqueID newCell.setAttribute("className", "css-name"); newCell.innerHTML = "<center><INPUT TYPE=\"TEXT\" STYLE=\"width: 80px\" CLASS=\"form-control\" NAME=\"Column5_"+intLine+"\" VALUE=\"\"></center>" */ document.frmMain.hdnMaxLine.value = intLine; } function RemoveRow() { intLine = parseInt(document.frmMain.hdnMaxLine.value); if(parseInt(intLine) > 0) { theTable = (document.all) ? document.all.tbExp : document.getElementById("tbExp") theTableBody = theTable.tBodies[0]; theTableBody.deleteRow(intLine); intLine--; document.frmMain.hdnMaxLine.value = intLine; } }
<body Onload="CreateNewRow();CreateNewRow();CreateNewRow();"> <div class="panel"> <div class="panel-body"> <h4><i class="glyphicon glyphicon-tasks"></i> Batch Number</h4> <hr> <form id="frmMain" name="frmMain" method="post"> <a href='#' class="btn btn-theme03" onclick='return endBatch()'> <i class='glyphicon glyphicon-ok'></i> บันทึก </a> <input type="hidden" name="hdnMaxLine" value="0"> <input name="btnAdd" class="btn btn-primary" type="button" id="btnAdd" value="+" onClick="CreateNewRow();"> <input name="btnDel" class="btn btn-primary" type="button" id="btnDel" value="-" onClick="RemoveRow();"> <table id="tbExp" class='table table-bordered table-striped' style='margin-top: 25px;'> <tr style='color: #ffffff;font-weight: bold;'> <td style='background: #000000'><div align="center">Batch Number</div></td> <td style='background: #000000'><div align="center">จำนวนคงเหลือ</div></td> <td style='background: #000000'><div align="center"> เข้า</div></td> <td style='background: #000000'><div align="center"> ออก </div></td> </tr> </table> </form> </div> </div> </body>
for ($i = 0; $i < count($_POST['std_id']); $i++){ $std_id = $_POST['std_id'][$i]; //Insert Statement }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง