I am trying this code
echo "<select>" .$main_nav = menu_tree('secondary-links'); print"<option>" . $main_nav . " </option></select>";<br>
but it display all menu at ones
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
It looks like you're building a so-called "jump menu", is that correct?
It's not considered good practice to code a menu into a template like you're doing in your example. Try to build the functionality of your site with modules (existing ones, or custom) and use the theme (template.php, CSS files, template files) for appearance only.
If you need a jump menu, have a look at the Jump module. It provides a block for every top-level menu and every vocabulary, so it could get you exactly what you need without writing one line of code.