I was thinking, what is the best way to manage a form with a variable number of fields?
Suppose you have the fields “phone1”, “phone2” and “phone3”, how can I insert the data into a database, not knowing how many fields I need to insert before the form gets submitted?
Which then returns all phones in an array ($_POST[‘phone’][0], etc). You could save them in a single database field by imploding them on an unused character (something other than a number) after sanitizing them.
imploding the entries of the array makes it a single string with a given delimiter. single string = single field, no matter how many phone numbers there are.