<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script type="text/javascript"> $(function(){ $("#addRow").click(function(){ $(".firstTr:eq(0)").clone(true) .find("input").attr('txt1',"").end() .find("select").attr('txt2',"").end() .appendTo($("#myTbl")); }); $("#removeRow").click(function(){ if($("#myTbl tr").size()>1){ $("#myTbl tr:last").remove(); }else{ alert("ต้องมีรายการข้อมูลอย่างน้อย 1 รายการ"); } }); }); </script> <form id="form1" name="form1" method="post" action="save_lists.php"> <td colspan="3"><table id="myTbl" width="443" border="1" cellspacing="2" cellpadding="0"> <tr class="firstTr"> <td width="388"><input type="text" name="txt1" /> </tr> <tr class="firstTr"></tr> </table><table width="447" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="447"><button id="addRow" type="button">+</button> <button id="removeRow" type="button">-</button> </td> <button class="btn btn-primary">save</button>
<?php include('connect.php');?> <? $txt1=$_REQUEST['txt1']; echo "$txt1"; $sql_user="INSERT INTO lists (Adoption) values('$txt1')"; mysqli_query($con,$sql_user); echo "สำเร็จ"; ?>
<?php include('connect.php');?> <? $txt1=$_REQUEST['txt1']; for($i=0;$i<count($_POST["txt1"]);$i++) { echo "txt1 $i = ".$_POST["txt1"][$i]."<br>"; } $sql_add="INSERT INTO lists (Adoption) values('".$_POST["txt1"][$i]."')"; mysqli_query($con,$sql_add); ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง