So I have a snip of code. Basically what the code is supposed to do is select the distinct items in my Items database and put them in Drop Down Boxes.
print "<h3 align=\"center\">Add Equipment</h3><hr />";
$query = "SELECT DISTINCT secondary_cat, sub_cat FROM items";
$res = mysql_query($query);
$optSeGroup = "<select name=\"secondaryCat\"><option value=\"-1\"></option>";
$optSuGroup = "<select name=\"subCat\"><option value=\"-1\"></option>";
if($res)
{
while($a_row = mysql_fetch_array($res, MYSQL_ASSOC))
{
foreach($a_row as $row)
{
print "<div>".$row["secondary_cat"]."</div>";
print "<div>".$row["sub_cat"]."</div>";
$optSeGroup .= "<option value=\"".$row["secondary_cat"]."\">".$row["secondary_cat"]."</option>";
$optSuGroup .= "<option value=\"".$row["sub_cat"]."\">".$row["sub_cat"]."</option>";
}//end foreach
}//end while
}//end if null
$optSeGroup .= "</select>";
$optSuGroup .= "</select>";
In the items table there are three entries two for the unique entries in the secondary_cat are Alpine and Telemark and the Unique Entries for sub_cat are Boot and Ski. So I run the query above in phpMyAdmin and I get my desired results. But when I run the following script the values placed in my drop down boxes are T S A B. I can see that they pull the right values just not the entire word.
Any help on this problem that can be offered would be greatly appreciated.