-1
嗨,我想顯示在下拉列表中顯示我從數據庫中提取的類別。目前他們正在被拉出,並剛剛在我創建的菜單欄中排成一行。我的代碼到目前爲止是:當從數據庫中提取數據時創建一個下拉列表
<?php
/*
Displaying List of Categories from the Table - Category and that is limited to 6
*/
$qry=mysql_query("SELECT * FROM category ", $con);
if(!$qry)
{
die("Query Failed: ". mysql_error());
}
/* Fetching datas from the field "category" and article id is transfered to articles.php file */
while($row=mysql_fetch_array($qry))
{
echo " <a href=articles.php?cat=".$row['category'].">".$row['category']."</a>
";
}
?>
任何幫助,將不勝感激 感謝
是的,它把它變成一個下拉列表,但在此之前,當沒有下拉列表,我選擇了相應的信息從數據庫中拉出的不同選項,現在當我從下拉列表中選擇選項時,選擇的選項不會檢索數據? @Aamir Siddique – user3550417
你需要使用字段名稱(在db中定義)來代替'category'。 –