🕸Fergus Duniho wrote on Fri, Oct 14, 2022 05:04 PM UTC:
After doing some experimenting, I have determined that the normal way for HTML to pass multiple values to the same PHP variable is through a series of array assignments. For example, category[]=Hexagonal&category[]=ShogiBased instead of category=Hexagonal,ShogiBased. This page does the latter, but it relies on JavaScript to get the job done. For multiple assignments to work in HTML, the variable name in the form should include square brackets after it, which causes PHP to interpret it as the assignment of a new array element. For a SELECT element, you also have to use the MULTIPLE attribute with it to enable it to allow selection of multiple options. For checkboxes with the same name, this is not needed.
After doing some experimenting, I have determined that the normal way for HTML to pass multiple values to the same PHP variable is through a series of array assignments. For example, category[]=Hexagonal&category[]=ShogiBased instead of category=Hexagonal,ShogiBased. This page does the latter, but it relies on JavaScript to get the job done. For multiple assignments to work in HTML, the variable name in the form should include square brackets after it, which causes PHP to interpret it as the assignment of a new array element. For a SELECT element, you also have to use the MULTIPLE attribute with it to enable it to allow selection of multiple options. For checkboxes with the same name, this is not needed.