What is the purpose of using the multiple attribute in a select field in PHP forms?
When using the multiple attribute in a select field in PHP forms, it allows users to select multiple options from a dropdown list. This is useful when you want to allow users to select more than one option at a time, such as selecting multiple categories for a post or selecting multiple items to add to a shopping cart.
<select name="categories[]" multiple>
<option value="1">Category 1</option>
<option value="2">Category 2</option>
<option value="3">Category 3</option>
</select>