'How to add new text field when button is clicked then collect the value of each added text field?

I can already add new text field on the click of the button, however I need to collect the value of each added text field and save those into the database (mysql)

This is the code



Solution 1:[1]

You can create an array to push each new word/ modified word into with something like this:

const words= [];
words.push("WORD");

See more at https://www.w3schools.com/jsref/jsref_push.asp

Now, regarding the MySQL part : you can not achieve access to a database from pure JavaScript on client side. You would need NodeJS in order to achieve access.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nicolas Silva