Selection Menu Function, mutliple instances in php
<p>Ok I have the following function that creates a select menu so a user can choose a state.</p>

<pre><code>function state_selection()
{
    $str = '&lt;select name="state"&gt;';
    $states = array(
            'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'District of Columbia', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'
        );
    foreach ($states as $state_name)
    {
        $str .= '&lt;option value="'.$state_name.'"&gt;'.$state_name.'&lt;/option&gt;';
    }
    $str .= '&lt;/select&gt;';

    return $str;
}
</code></pre>

<p>My question is... This works great if there is just one state selection on that page... but in my form I need the user to select several states, sometimes as many as 12.  How can I change the function to be able to reuse it several times within the same form... and still have it send each selection as a seperate variable.</p>
