简体   繁体   中英

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?

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,

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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