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

1k views Asked by At

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 ?

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,

1

There are 1 answers

0
Abhijeet Umbarkar On

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.