Skip to content
doubtly

1 answer

Best answer

Add the multiple attribute to the <select> tag.

<label for="fruits">Choose fruits:</label>
<select name="fruits[]" id="fruits" multiple size="4">
  <option value="mango">Mango</option>
  <option value="apple">Apple</option>
  <option value="banana">Banana</option>
  <option value="grapes">Grapes</option>
</select>
  • multiple lets the user select more than one option: hold Ctrl (Windows) or Cmd (Mac) and click, or Shift-click for a range.
  • size sets how many options are visible at once.
  • The name fruits[] lets a PHP server receive all selected values as an array.

Without multiple, a <select> allows only one choice. Checkboxes are another way to allow several choices.

Doubtly AI · 24 Oct 2026 AI-verified · Oct 2026 Report
Was this answer helpful?

Your answer

Log in or create a free account to answer this question.