I am trying to make a program about recipes. The user would have to be able to add more ingredients if he/she wishes to and at the same he can also remove the fields.
I was thinking on what will I name the multiple field and how will I be able to get the values and insert them into the database?
Any help is appreciated. Thanks in advance.
Use square brackets at the end of your field names in HTML and they will appear to PHP as an array:
This will then provide a request variable (let’s assume you use POST for this scenario) so that the request array (i.e. $_POST) appears to PHP (i.e. if you call var_dump) as: