Hi, I am newbie in js. What I like is far from my knowledge. Please help. - parentid = 0 if main categories, and parentid != 0 if it belongs a main category (subcategory) <select name=category> <option value=''>Choose...</option> $categories_list </select> PHP: It list all main categories from my data, but I want something like: if I've chosen a main category (which = 0), then it appears js subcategories (which != 0). In php here are you: $sql = mysql_query("SELECT * FROM categories WHERE `parentid`='0'"); while ($row = mysql_fetch_assoc($sql)) { $out .= "<a href=\"./subcategories.php?cat=".$row['id']."\">".$row['catname']."</a>"; $cat = $row['id']; $sql1 = mysql_query("SELECT * FROM categories WHERE parentid=$cat"); while ($row1 = mysql_fetch_assoc($sql1)) { $out.= "<a href=\"./">".$row1['catname']."</a>"; PHP: But how in js so that it pop up subcategories after chosen a main category?