Form that uses array, assign object to array
<p>I need to create a form that allows the user to select a number from 0 to 7 and "show all" and the script will then output the object found in that train car to the user, or if show all is picked then it runs a loop that shows all 8 objects along with the train number. But my code doesn't really run.
(Please ignore my code if it doesn't make any sense, but I don't seem to get arrays :( Please point out the mistakes and thank you so so so much)</p>

<pre><code>&lt;html&gt;
&lt;body&gt;
&lt;form name="train" method="GET" action="test.php"&gt;

&lt;select&gt;
&lt;option value="0" name="object"&gt;0&lt;/option&gt;
&lt;option value="1" name="object"&gt;1&lt;/option&gt;
&lt;option value="2" name="object"&gt;2&lt;/option&gt;
&lt;option value="3" name="object"&gt;3&lt;/option&gt;
&lt;option value="4" name="object"&gt;4&lt;/option&gt;
&lt;option value="5" name="object"&gt;5&lt;/option&gt;
&lt;option value="6" name="object"&gt;6&lt;/option&gt;
&lt;option value="7" name="object"&gt;7&lt;/option&gt;
&lt;option value="8" name="object"&gt;8&lt;/option&gt;
&lt;option value="all" name="all"&gt;Show All&lt;/option&gt;
&lt;/select&gt;

&lt;input type="submit" name="submit" id="submit" value="submit" size="10"&gt;
&lt;/form&gt;

&lt;?php

$train[0] ="pencil";
$train[1] = "macaron";
$train[2] = "notes";
$train[3] = "book";
$train[4] = "eraser";
$train[5] = "cake";
$train[6] = "laptop";
$train[7] = "mint";
$train[8] = "cup";

if ($_GET['submit']) { 
  $train = $_GET['object']; 
  echo "&lt;p&gt;I have $train!&lt;/p&gt;";
}

for ($i = 0; $i &lt; sizeof($train); $i++) {
  echo "&lt;li&gt;" . $train[$i] . "&lt;/li&gt;";
}   

?&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>