Allows for a dynamic number of input fields within HTML forms
Useful for forms such as grocery lists, where the amount of input fields may vary
- Amend the 'action' attribute for the "insert-list" form within index.html to match your target page, such as to "/insert-list.php" for example:
action="/insert-list.php"
- Within your target file, to extract the submitted data in PHP:
$fieldArray = $_POST['dynamicField'];
- Amend the max amount of input fields within scripts.js as follows:
const maxField = 25
Example grocery list for a recipe (1)
Example grocery list for a recipe (2)