The board has 3 code-related tags: code, php and html. If you "go advanced" you will see all of them in the editor, along with some other formatting options.
As for the selected option comparison, you are not comparing the proper things.
# this is done early in your script
$category = $_GET["part_name"];
# $compare now holds the selected value
# further down...
$category = mysqli_query($dbc,$q1);
# $category is now either boolean false, or a mysqli result resource. as such, you can
# no longer expect this to work
($category == $row["part_name"] ? " selected" : "")
You also do the same thing with $subcategory.
Personally I'd also split up your table data into two tables
menu
----------------
id
label
submenu
---------------
id
label
menu_id
For which you retrieve your data as such
SELECT menu.id AS menu_id, menu.label AS menu_label, submenu.label AS sub_label, submenu.id AS sub_id
FROM menu
INNER JOIN submenu ON menu_id = menu.id
This way you no longer have redundant data (other than the foreign key "menu_id", while you previously stored each menu label once per submenu item.
Vaidate your html code here. The <script> element has no "language" attribute, and if it did it could not be "javascript", but rather "en", "us-en", "fr" etc. What it does and should have though, is a type attribute: type="text/javascript".
If you serve xhtml rather than html, make your attribute names lowercase (onChange => onchange), and change 'selected' into 'selected="selected"'