简体   繁体   English

动态添加/删除多个输入字段和输入行 PHP (Dynamic form In Dynamic Form)

[英]add/remove multiple input fields and input rows dynamically PHP (Dynamic form In Dynamic Form)

i am making a dynamic PHP form, i have successfully making dynamic form, how if i want to make form dynamic in dynamic fields, like in the table make a dynamic fields in dynamic Rows?我正在制作动态 PHP 表单,我已经成功制作了动态表单,如果我想在动态字段中使表单动态化,例如在表格中创建动态行中的动态字段,该怎么办?

this is my form view这是我的表单视图

$(document).ready(function(){
      var count = 0;
      $(document).on('click', '#addformdanger', function(){
        count++;
        var html = '';

                  html += '<section>';
                  html += '<hr>';
                  html += 'my child form';

$('#form-body-danger').append(html); 
});
$(document).on('click', '#addprocess', function(){
        count++;
        var html = '';

                  html += '<section>';
                  html += '<hr>';
                  html += 'form child';

$('#form-body-process').append(html);
});


$(document).on('click', '.remove-danger',function(){
               $(this).closest('section').remove();
            });

$(document).on('click', '.remove-process',function(){
               $(this).closest('section').remove();
            });

this My Output what i want,这是我想要的我的 Output,

From what you've mentioned, what i understand is you're making a form in which user can add multiple inputs.从您提到的内容来看,我的理解是您正在制作一个用户可以添加多个输入的表单。 And on clicking on submit, data should be sent back to server.点击提交后,数据应发送回服务器。

If this is the problem kindly visit here .如果这是问题,请访问这里

You can also refer .也可以参考

Both will helps you to create forms where user can add/remove more fields as per need.两者都将帮助您创建 forms,用户可以根据需要添加/删除更多字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM