<? include_once '../includes/connect.php'; ?> <script src="../includes/js/jquery/jquery.form.js" type="text/javascript"></script> <script type="text/javascript" src="../includes/js/jquery/jquery.datepick.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#myForm").submit(function () { if($("#popupDatepicker").val() == ''){ alert("คุณไม่ได้กรอก วันที่"); return false; } else if($("#ph").val() == ''){ alert("คุณไม่ได้กรอกค่า ph"); return false; } else if($("#temp").val() == 'เช้า:'){ alert("คุณไม่ได้กรอกค่า อุณหภูมิ"); return false; } else if($("#lux").val() == 'เช้า:'){ alert("คุณไม่ได้กรอกค่า ความเข้มแสง"); return false; } else if($("#grow").val() == ''){ alert("คุณไม่ได้กรอกค่า ความเจริญเติบโต"); return false; } else if($("#product").val() == ''){ alert("คุณไม่ได้กรอกค่า ผลผลิต"); return false; } }); }); </script> <script type="text/javascript"> $(function() { $('#popupDatepicker').datepick({dateFormat: 'yyyy-mm-dd'}); $('#inlineDatepicker').datepick({onSelect: showDate}); }); function showDate(date) { alert('The date chosen is ' + date); } </script> <script type="text/javascript"> $(document).ready(function() { $('#myForm').ajaxForm({ dataType: 'json', success: function processJson(resPonse) { if(resPonse==1){ $('#Loading').hide(); $('#Loading1').show(); $('#Loading1').fadeOut(1500); $('#myForm').reset(); } else { $('#Loading1').hide(); $('#Loading').show(); $('#Loading1').show(1500); } } }); }); function clearValue(obj,text) { if ( obj.value == text ) obj.value = ''; } function checkValue(obj,text) { if ( obj.value == '' ) obj.value = text; } </script> <script language="javascript" src="js/jquery-1.4.1.min.js"></script> <script type="text/javascript"> $(function(){ $("#addRow").click(function(){ $("#tb").append($("#trc").clone()); }); $("#removeRow").click(function(){ if($("#tb tr").size()>1){ $("#tb tr:last").remove(); }else{ alert("ต้องมีรายการข้อมูลอย่างน้อย 1 รายการ"); } }); }); </script> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr><td style="border: 1px dashed #dedbd1; padding: 6px; margin: 1px; background-color: #ebe9e1; font-weight: bold; font-size: 15px;">เพิ่มข้อมูลการทดลอง</td></tr> <tr> <td align="left" style="padding-left:5px; height:29px; line-height:29px;"><a href="javascript:LoadContentDIV('dataAdd.php');">[+] เพิ่มข้อมูลรายบ่อ</a></td></tr> </table> <form name="myForm" id="myForm" action="dataAdd_script.php" method="post"> <table width="100%" cellpadding="9" cellspacing="0" border="0"> <tr> <td width="5%" class="TD_title">วันที่: </td> <td align="left" width="95%"><input name="popupDatepicker" type="text" class="textbox" value="<? echo date('Y-m-d')?>" id="popupDatepicker" > </td> </tr> </table> <table id="tb" width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#dedbd1"> <tr> <td width="7%" height="25" rowspan="2" align="center" bgcolor="#ebe9e1"><strong>บ่อ</strong></td> <td width="7%" height="25" rowspan="2" align="center" bgcolor="#ebe9e1"><strong>PH</strong></td> <td height="20" colspan="2" align="center" bgcolor="#ebe9e1"><strong>อุณหภูมิ</strong></td> <td height="20" colspan="2" align="center" bgcolor="#ebe9e1"><strong>ความเข้มแสง</strong></td> <td width="11%" height="25" rowspan="2" align="center" bgcolor="#ebe9e1"><strong>การเจริญเติบโต</strong></td> <td width="7%" height="25" rowspan="2" align="center" bgcolor="#ebe9e1"><strong>น้ำหนักเปียก</strong></td> <td width="7%" height="25" rowspan="2" align="center" bgcolor="#ebe9e1"><strong>น้ำหนักแห้ง</strong></td> </tr> <tr> <td width="10%" height="25" align="center" bgcolor="#EBE9E1">เช้า</td> <td width="10%" height="25" align="center" bgcolor="#EBE9E1">บ่าย</td> <td width="7%" height="25" align="center" bgcolor="#EBE9E1">เช้า</td> <td width="7%" height="25" align="center" bgcolor="#EBE9E1">บ่าย</td> </tr> <tr id="trc"> <td height="25" align="center" bgcolor="#FFFFFF"><select name="pool" id="pool"> <option>เลือกบ่อ..</option> <? $res1 = Query("select * from algaepool where status = 'y' "); $pool_count = mysql_num_rows($res1); if($pool_count > 0) { while($poolArr=mysql_fetch_array($res1)){ ?> <option value="<?=$poolArr['id']?>"><?=$poolArr['name']?></option> <? } } ?> </select></td> <td height="25" align="center" bgcolor="#FFFFFF"><label> <input type="text" name="ph" id="ph" class="textboxshort" /> </label></td> <td height="25" align="center" bgcolor="#FFFFFF"><label> <input type="text" name="temp" id="temp" class="textboxshort" /> </label></td> <td height="25" align="center" bgcolor="#FFFFFF"><label> <input type="text" name="temp_after" id="temp_after" class="textboxshort" /> </label></td> <td height="25" align="center" bgcolor="#FFFFFF"><label> <input type="text" name="lux" id="lux" class="textboxshort" /> </label></td> <td height="25" align="center" bgcolor="#FFFFFF"><label> <input type="text" name="lux_after" id="lux_after" class="textboxshort" /> </label></td> <td height="25" align="center" bgcolor="#FFFFFF"><label> <input type="text" name="grow" id="grow" class="textboxshort" /> </label></td> <td height="25" align="center" bgcolor="#FFFFFF"><label> <input type="text" name="wet" id="wet" class="textboxshort" /> </label></td> <td height="25" align="center" bgcolor="#FFFFFF"><label> <input type="text" name="dry" id="dry" class="textboxshort" /> </label></td> </tr> </table> <p> <label> <input type="button" name="multi" id="addRow" value="[+] เพิ่มแถว" class="buttonplus" /> </label> </p> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><div id="buttonDiv"><input type="submit" name="button1" value="บันทึก" class="button" > <input type="button" name="button2" value="ย้อนกลับ" onclick="javascript:LoadContentDIV('timeList.php');" class="button"></div> <div id="Loading" style="padding: 10px; text-align: center; display:none; color: red;"><img src="../images/loader_twt.gif" /> กำลังบันทึกข้อมูล..</div></td> </tr> </table> </form>
$aryPh = $_POST["ph"]; for($i=0;$i<count($aryPh);$i++){ $sqlCmd = " Insert into tablename (fieldA) values ('$aryPh[$i]'); mysql_query($sqlCmd); }
$aryPh = $_POST["ph"]; $aryTemp = $_POST["temp"];
for($i=0;$i<count($A);$i++){ A[$i]; B[$i]; }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง