What is the correct syntax for naming multiple select dropdown lists in PHP to ensure proper array handling?

When naming multiple select dropdown lists in PHP, each select element should have a name attribute ending with "[]". This ensures that the selected values are submitted as an array. By using this naming convention, PHP can handle the form data as an array, allowing you to easily loop through and process the selected options.

<select name="colors[]" multiple>
  <option value="red">Red</option>
  <option value="blue">Blue</option>
  <option value="green">Green</option>
</select>

<select name="sizes[]" multiple>
  <option value="small">Small</option>
  <option value="medium">Medium</option>
  <option value="large">Large</option>
</select>