<style type="text/css"> <!-- .style1 { font-family: "TH SarabunPSK"; font-size: 18pt; font-weight: bold; } .style2 { font-family: "TH SarabunPSK"; font-size: 16pt; font-weight: bold; } .style5 {cursor: hand; font-weight: normal; color: #000000;} .style9 {font-family: Tahoma; font-size: 12px; } .style11 {font-size: 12px} .style13 {font-size: 9} .style16 {font-size: 9; font-weight: bold; } .style17 {font-size: 12px; font-weight: bold; } --> </style> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <script type="text/javascript" src="jquery-1.11.1.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#add_item').click(function(){ $('#mytbl tbody tr ').last().clone().appendTo('#mytbl tbody'); }); }); function doRemoveItem(obj){ if($('#mytbl tbody tr').size() > 1){ if(confirm('คุณต้องการลบแถวนี้?')) $(obj).parent().parent().remove(); }else{ alert('ไม่อนุญาตให้ลบแถวที่เหลือนี้ได้'); } } </script> <? require("connect.php"); ?> <?php $sql="SELECT * FROM tbbudgettype"; $result=mysql_query($sql,$conn); mysql_query("SET NAMES UTF8"); $rs = mysql_fetch_array($result); ?> <table align="center" width="1150" border="0" cellspacing="0" cellpadding="0"> <tr> <td><? require('head.php') ?></td> </tr> <tr height="300"> <td bgcolor="#F8F8F8" height="300"align="center"> <form name="form1" method="post" action = "ae.php"> <table width="809" height="99" border="1" align="center" cellpadding="0" cellspacing="0" bgcolor="#F8F8F8"> <thead> <tr> <td width="128" height="28" class="style2">ปีงบประมาณ</td> <td><input type="text" name="txtbudget" id="txtbudget" /></td> </tr> </thead> <tr> <td height="31" class="style2">จำนวนงบประมาณ</td> <td><input type="text" name="txtmoney3" id="txtname5" /></td> </tr> </table> <table width="809" border="1" id = "mytbl"> <thead> <tr> <td colspan="5"> </td> </tr> </thead> <tbody> <tr > <td width="101"><span class="style2">หมวดงบประมาณ</span></td> <td width="41"><select name="BudgettypeID"> <? mysql_query("SET NAMES UTF8"); $result = mysql_query("SELECT * FROM tbbudgettype"); while($row = mysql_fetch_array($result)){ ?> <option value="<? echo $row['BudgettypeID']; ?>"><? echo $row['Budgettype'];?></option> <? }?> </select></td> <td width="110"><span class="style2">จำนวนเงินในหมวด</span></td> <td width="144"><input type="text" name="txtbudgettypemoney[]" /></td> <td width="8"><button onclick="javascript:doRemoveItem(this);" style="width:22px;">-</button></td> </tr> </tbody> </table> <table width="809" border="1"> <tr> <td><button type="button" id="add_item" name="button" id="button" ><img src="picture/add.png" width="16" height="16" align="absmiddle" />เพิ่มหมวดหมู่</button></td> </tr> </table> <p> </p> <p> <input type="submit" name="button" id="button3" value="ตกลง" /> <input type ="reset" name="button2" id="button4" value="ยกเลิก" /> </p> <p> </p> </form></td></tr></table> <p> </p> </html>
<style type="text/css"> <!-- .style1 { font-family: "TH SarabunPSK"; font-size: 18pt; font-weight: bold; } .style2 { font-family: "TH SarabunPSK"; font-size: 16pt; font-weight: bold; } .style5 {cursor: hand; font-weight: normal; color: #000000;} .style9 {font-family: Tahoma; font-size: 12px; } .style11 {font-size: 12px} .style13 {font-size: 9} .style16 {font-size: 9; font-weight: bold; } .style17 {font-size: 12px; font-weight: bold; } --> </style> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <script type="text/javascript" src="jquery-1.11.1.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#add_item').click(function(){ $('#mytbl tbody tr ').last().clone().appendTo('#mytbl tbody'); }); }); function doRemoveItem(obj){ if($('#mytbl tbody tr').size() > 1){ if(confirm('คุณต้องการลบแถวนี้?')) $(obj).parent().parent().remove(); }else{ alert('ไม่อนุญาตให้ลบแถวที่เหลือนี้ได้'); } } </script> <? require("connect.php"); ?> <?php $sql="SELECT * FROM tbbudgettype"; $result=mysql_query($sql,$conn); mysql_query("SET NAMES UTF8"); $rs = mysql_fetch_array($result); ?> <table align="center" width="1150" border="0" cellspacing="0" cellpadding="0"> <tr> <td><? require('head.php') ?></td> </tr> <tr height="300"> <td bgcolor="#F8F8F8" height="300"align="center"> <form name="form1" method="post" action = "ae.php"> <table width="809" height="99" border="1" align="center" cellpadding="0" cellspacing="0" bgcolor="#F8F8F8"> <thead> <tr> <td width="128" height="28" class="style2">ปีงบประมาณ</td> <td><input type="text" name="txtbudget" id="txtbudget" /></td> </tr> </thead> <tr> <td height="31" class="style2">จำนวนงบประมาณ</td> <td><input type="text" name="txtmoney3" id="txtname5" /></td> </tr> </table> <table width="809" border="1" id = "mytbl"> <thead> <tr> <td colspan="5"> </td> </tr> </thead> <tbody> <tr > <td width="101"><span class="style2">หมวดงบประมาณ</span></td> <td width="41"><select name="BudgettypeID[]"> <? mysql_query("SET NAMES UTF8"); $result = mysql_query("SELECT * FROM tbbudgettype"); while($row = mysql_fetch_array($result)){ ?> <option value="<? echo $row['BudgettypeID']; ?>"><? echo $row['Budgettype'];?></option> <? }?> </select></td> <td width="110"><span class="style2">จำนวนเงินในหมวด</span></td> <td width="144"><input type="text" name="txtbudgettypemoney[]" /></td> <td width="8"><button onclick="javascript:doRemoveItem(this);" style="width:22px;">-</button></td> </tr> </tbody> </table> <table width="809" border="1"> <tr> <td><button type="button" id="add_item" name="button" id="button" ><img src="picture/add.png" width="16" height="16" align="absmiddle" />เพิ่มหมวดหมู่</button></td> </tr> </table> <p> </p> <p> <input type="submit" name="button" id="button3" value="ตกลง" /> <input type ="reset" name="button2" id="button4" value="ยกเลิก" /> </p> <p> </p> </form></td></tr></table> <p> </p> </html>
$max = count($_POST["BudgettypeID"]); for($i=0; $i < $max; ++i){ echo "Budget ID:".$_POST["BudgettypeID"][$i]." = ".$_POST["txtbudgettypemoney"][$i]." บาท"; }
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <? require('connect.php'); ?> <?php $max = count($_POST["BudgettypeID"]); for($i=0; $i < $max; ++$i) { echo "Budget ID:".$_POST["BudgettypeID"][$i]." = ".$_POST["txtbudgettypemoney"][$i]." บาท"; echo "<br>"; } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง