As the title says, How would I do this?
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
My code right now:
if (count($_POST) > 0) {
if (strlen($_POST['topic']) < 1)
$errorMsg = "Please select a topic.";
else if (strlen($_POST['message']) < 1)
$errorMsg = "You have to enter a message.";
}
$topics = mysql_query("SELECT name FROM topics ORDER BY name ASC");
echo '<option value="-1" selected="selected">(Choose Topic)</option>';
while ($t = mysql_fetch_assoc($topics)) {
echo '<option value="'.$t['id'].'">'.htmlspecialchars($t['name']).'</option>';
}