Remember select menu option choice
<p>As the title says, How would I do this?</p>

<p>So lets say if the user left message empty but selected a correct topic, I want that topic to be selected after the page has refreshed</p>

<p>My code right now:</p>

<pre><code>if (count($_POST) &gt; 0) {

    if (strlen($_POST['topic']) &lt; 1) 
        $errorMsg = "Please select a topic.";
else if (strlen($_POST['message']) &lt; 1)
    $errorMsg = "You have to enter a message.";

}


$topics = mysql_query("SELECT name FROM topics ORDER BY name ASC");

echo '&lt;option value="-1" selected="selected"&gt;(Choose Topic)&lt;/option&gt;';
while ($t = mysql_fetch_assoc($topics)) {
    echo '&lt;option value="'.$t['id'].'"&gt;'.htmlspecialchars($t['name']).'&lt;/option&gt;';
}
</code></pre>
