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
<div class="fields">
<!-- There will be added fields -->
<button id="add-field">Add field</button>
<input type="submit" value="Send">

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

foreach ($data as $item -> $key) {


Find more questions by tags PHP