2010-07-13 241 views
0

如標題所示,我該怎麼做?記住選擇菜單選項選項

因此,可以說,如果用戶離開信息爲空,但選擇正確的話題,我想在頁面刷新

我的代碼後,現在就可以選擇該主題:

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>'; 
} 
+0

你可以添加更多的代碼,以顯示在''