小编bob*_*lie的帖子

Codeigniter验证表单中的数组

我有一张带桌子的表格.该表包括三个用户输入.数量,行项目和价格.在用户提交表单之前,我需要填写所有三个.该表允许添加行.

这是我的桌子.

<form id="add_quote_form" name="add_quote_form" class="form-horizontal">
   <table style="width: 90%" id="myTable" class="centered-table table table-bordered">
   <thead>
    <tr>
        <th>Item</th>
        <th>Qty</th>
        <th>Price</th>
        <th>Action</th>
     </tr>
    </thead>
    <tbody>
      <tr>
        <td style="width: 60%"><input type="text" name="detail[]"required></td>
        <td style="width: 10%"><input type="number" name="qty[]" required></td>
        <td style="width: 15%"><input type="number" name="price[]" required></td>
        <td style="width: 12%"><div class="inline"><input type="button" id="addButton" class="btn btn-primary btn-xs" value="Add"/></div><div class="inline"><input type="button" id="deleteButton" class="btn btn-primary btn-xs" value="Delete"/></div>
       </tr>
    </tbody>
   </table>
   <input type="button" id="saveBtn" name="saveBtn" class="btn btn-primary" value="Create Order" onClick="this.disabled=true; add_quotation();return false;">
</form>
Run Code Online (Sandbox Code Playgroud)

向表中添加行的功能

$(function(){
    $("#addButton").click(function(){
        $(this).closest("tr").clone(true).appendTo("#myTable");
    });

    $("#deleteButton").click(function(){
//      var …
Run Code Online (Sandbox Code Playgroud)

php forms validation codeigniter

5
推荐指数
1
解决办法
3383
查看次数

标签 统计

codeigniter ×1

forms ×1

php ×1

validation ×1