How can a list from an HTML form be passed to a PHP document using variables?

To pass a list from an HTML form to a PHP document using variables, you can use the `name` attribute in the form input elements to create an array in PHP. By setting the `name` attribute with square brackets `[]`, PHP will automatically convert the input values into an array. In the PHP document, you can then access the values of the list using the `$_POST` or `$_GET` superglobals.

// HTML form
<form method="post" action="process_form.php">
  <input type="text" name="list[]" />
  <input type="text" name="list[]" />
  <input type="text" name="list[]" />
  <input type="submit" value="Submit" />
</form>

// process_form.php
<?php
$list = $_POST['list'];
foreach ($list as $item) {
  echo $item . "<br>";
}
?>