Are there any alternative methods to display multiple checkbox selections in PHP forms?

When using multiple checkboxes in PHP forms, the traditional method involves creating separate checkbox inputs for each option. However, an alternative method is to use an array for the checkbox inputs, which allows for easier handling of multiple selections.

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

In the PHP processing script (process_form.php), you can access the selected checkbox values as an array:

```php
$selectedColors = $_POST['colors'];
foreach($selectedColors as $color) {
    echo $color . "<br>";
}