Use isset to add to an array
<p>I would like a new item to be added to an array if a button is pressed</p>

<p>This is my code...</p>

<pre><code>$engineers = array();

if(isset($_POST['add_user'])){
    $engineers[] = $_POST['engineer'];
    $array_count = count($engineers);
}
</code></pre>

<p>All it does is replace the only item in the array rather than add to it, where am I going wrong?</p>

<p>Thanks</p>

<p>The form used is </p>

<pre><code>$dropdown = '&lt;select id="engineer" name="engineer" class="select_engineer" type="text" name="engineer" /&gt;&lt;option&gt;Select Diary&lt;/option&gt;';
while($row = mysql_fetch_assoc($result)){
    $dropdown .= "\r\n&lt;option value='{$row['user_name']}'&gt;{$row['user_name']}&lt;/option&gt;";
}
$dropdown .= "\r\n&lt;/select&gt;";
</code></pre>

<p>">
         
        
        </p>

<p>(The list of engineers is populated from a MySQL database).</p>

<p>There isn't anywhere else that adds to the array, I just want a button that will add the engineers user name to the array</p>
