สอบถามวิธีสร้างตาราง แบบเพิ่มแถวได้ตามที่ต้องการครับ

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: สอบถามวิธีสร้างตาราง แบบเพิ่มแถวได้ตามที่ต้องการครับ

Re: สอบถามวิธีสร้างตาราง แบบเพิ่มแถวได้ตามที่ต้องการครับ

โดย birdkritsna » 10/10/2019 1:37 pm

mindphp เขียน:ลองดู
viewtopic.php?f=78&t=40767
ขอบคุณครับผม :-D

สอบถามวิธีสร้างตาราง แบบเพิ่มแถวได้ตามที่ต้องการครับ

โดย birdkritsna » 01/10/2019 3:48 pm

คือผมอยากให้มีปุ่ม เพิ่มแถวในตารางอะครับ ไม่ทราบว่าพอจะมีแนวทางการเขียนหรือตัวอย่างไหมครับผม
สมมติ กดปุ่ม + เพิ่ม 1 ครั้ง ตารางก็จะเพิ่ม ลำดับมาหนึ่งแถวครับ และสามารถกดลบ(-) แถวตารางได้เหมือนกันครับ หรือมีวิธีการเขียนรูปแบบอื่น ๆ แนะนำไหมครับ
4.jpg
4.jpg (9.02 KiB) Viewed 768 times

โค๊ดตาราง

โค้ด: เลือกทั้งหมด

<div align="center">
                                    <table class="table" border='1' >                
                                        <tbody>
                                            <tr>
                                               <td align="center" width="10%"><?php echo "ลำดับ"; ?> </td>
                                               <td align="center" width="50%"><?php echo "รายการ"; ?> </td>
                                               <td align="center" width="50%"><?php echo "จำนวน"; ?> </td>
                                               <td align="center" width="45%"><?php echo "ราคา/หน่วย"; ?> </td>
                                               <td align="center" width="40%"><?php echo "จำนวนเงิน"; ?> </td>
                                               </tr>
                                 
                                                <td><input type="text" required name="idd" class="form-control" autocomplete="off" placeholder="" value=""> </td> 
                                             
                                                <td>
                                                     <input type="text" required name="name2" class="form-control" autocomplete="off" placeholder="" value="">
                                                </td>
                                              
                                                <td>
                                                     <input type="text" required name="qty" class="form-control" autocomplete="off" placeholder="" value="">
                                                </td>
                                                 
                                                <td>
                                                     <input type="text" required name="price" class="form-control" autocomplete="off" placeholder="" value="">
                                                </td>
                                                <td>
                                                     <input type="text" required name="total" class="form-control" autocomplete="off" placeholder="" value="">
                                                </td>
                                            
                                              
                                    </table>
พอจะมีวิธีหรือแนวทางการทำไหมครับ

ข้างบน