PHP variable to store items for a list to appear many times on page?
<p>Hi All: I am new to creating arrays and am trying to create a variable to hold a list of items and print it multiple times on a page. Below is the PHP that I've attempted and below that is the HTML which shows the same SELECT list multiple times on the page. It is only listing the first item in the SELECT list. Other tweaks have resulted in the SELECT list having the complete list of items from the database, but any other calls to this variable elsewhere on the page fails.</p>

<p>What can I do to get a variable to hold this SELECT list so that I can print it multiple times on the page?</p>

<pre><code>    &lt;?php
    $catresult = mysql_query("SELECT * FROM Classes WHERE FK_UserID=$_SESSION[user_id] ORDER BY ClassName");
    $dataset = array();
    while($row = mysql_fetch_array($catresult)) {
            $dataset = '&lt;option value="' . $row['ClassID'] . '"&gt;' . $row['ClassName'] . '&lt;/option&gt;';
        }   
    ?&gt;

    &lt;!-- HTML below --&gt;

    Paragraph 1 content...
    &lt;select name="FK_ClassID" /&gt;&lt;option value=""&gt;Class&lt;/option&gt;&lt;?php echo $dataset; ?&gt;&lt;/select&gt;

    Paragraph 2 content...
    &lt;select name="FK_ClassID" /&gt;&lt;option value=""&gt;Class&lt;/option&gt;&lt;?php echo $dataset; ?&gt;&lt;/select&gt;

    Paragraph 3 content...
    &lt;select name="FK_ClassID" /&gt;&lt;option value=""&gt;Class&lt;/option&gt;&lt;?php echo $dataset; ?&gt;&lt;/select&gt;
</code></pre>
