Hello, I have having great difficulty in establishing what my problem is here (being a newbie doesnt help either). I am trying to get two Dropdown menus to display my categories and subcategories for the user to select when uploading new information to their db. Now the problem is that the subcategory dropdown seems to work alright but the category dropdown just has one blank space as the list...????? What am i doing wrong here??? Appreciate any help with this.....thanks
<?php
/ Category Dropdown /
$db = mysql_connect("localhost","root");
mysql_select_db("test",$db);
echo "<select name=\"category\">
<option selected>select existing category.......</option>";
$results = mysql_query("SELECT DISTINCT category FROM general",$db);
while ($myrow = mysql_fetch_array($results)) {
print ("<option value=\"$myrow[category]\">$myrow[category]");}
echo "</select>";
/ end Category list /
echo "</td>
<td valign=\"top\" align=\"left\" width=\"250\">
<input type=\"text\" name=\"category\" size=\"30\">
</td></tr>
<td align=\"left\">SubCategory</td><td align=\"left\">Create New SubCategory</td></tr>
<tr><td width=\"250\" align=\"left\" valign=\"top\">";
/ Subcategory Dropdown /
echo "<select name=\"subcategory\">
<option selected>select existing sub-category..</option>";
$result = mysql_query("SELECT DISTINCT subcategory FROM general",$db);
while ($myrow = mysql_fetch_array($result)) {
print ("<option value=\"$myrow[subcategory]\">$myrow[subcategory]");}
echo "</select>";
?>