What are the potential pitfalls of not using [] in checkbox names in PHP forms?

Potential pitfalls of not using [] in checkbox names in PHP forms include difficulty in processing multiple selected checkboxes as an array on the server-side. Without using [], only the last selected checkbox value will be passed to the server, causing data loss. To solve this issue, append [] to the checkbox names in the HTML form so that PHP can receive the values as an array.

<form action="process_form.php" method="post">
  <input type="checkbox" name="colors[]" value="red"> Red<br>
  <input type="checkbox" name="colors[]" value="blue"> Blue<br>
  <input type="checkbox" name="colors[]" value="green"> Green<br>
  <input type="submit" value="Submit">
</form>