1

Im using laravel guys here my

index.blade.php

<script type="text/javascript">
    $(document).ready(function(){
        var x =0;  
        $(".add-row").click(function(){
           x++;
           $("table > tbody").append('<input class="form-control" type="text" name="MFI" placeholder="Major Final Output" id="MFI" value="Participate in school activities">'); 
        }); //add input box
    });
</script>
Sumon Sarker
  • 2,707
  • 1
  • 23
  • 36
Pyo
  • 43
  • 1
  • 1
  • 6

1 Answers1

0

Here is an solution

$(document).ready(function(){
    var x = 0;  
    $(".add-row").click(function(){
       x++;
       $("table > tbody").append('<input class="form-control" type="text" name="MFI[]" placeholder="Major Final Output" id="MFI'+x+'" value="Participate in school activities">'); 
    }); //add input box
});

NOTE : Check table > tbody is exists in your HTML.

Sumon Sarker
  • 2,707
  • 1
  • 23
  • 36
  • Yes! You can save the values of dynamic fields with name `name="MFI[]"`. @Pyo – Sumon Sarker May 16 '17 at 03:07
  • After adding dynamic fields, Submit the form and debug the `REQUEST` in your Controller. @Pyo – Sumon Sarker May 16 '17 at 03:10
  • This URL can be helpful for saving multiple Data in Laravel http://stackoverflow.com/questions/29723865/how-to-insert-multiple-rows-from-a-single-query-using-eloquent-fluent , You just Prepare the Form Data before Save. @Pyo – Sumon Sarker May 16 '17 at 03:43