How to add fields and the formation of these variables?

Hello! This question:
I have a text box and a button (or link). How to make
1) by clicking on it appeared a text box
2) when clicking on another button ("Send") values from all text fields were recorded in the file and in the database?
July 2nd 19 at 17:37
1 answer
July 2nd 19 at 17:39
Solution
<div class="fields">
<!-- There will be added fields -->
</div>
<button id="add-field">Add field</button>
<input type="submit" value="Send">


$('#add-field').click(function() {
 var new_field = '<input type="text" name="nf[]">';
$('.fields').append(new_field);
});


$data=$_POST['nf'];
foreach ($data as $item -> $key) {

}

Find more questions by tags PHP