Support » Fixing WordPress » How configure multiple dropdown with submit button

  • Resolved crokis


    Hello people.

    I hope so that somebody can help me, please.

    I configured a dropdown with a submit button.
    Code here:

    <h2><?php _e('Categories:'); ?></h2><br>
    	<form action="<?php bloginfo('url'); ?>" method="get">
    	<?php wp_dropdown_categories('show_option_none=Selecciona el tipo&child_of=7'); ?>
    	<?php wp_dropdown_categories('show_option_none=Selecciona el producto&child_of=6'); ?>
    	<input type="submit" name="submit" value="view" />

    But, just show me results of a category.

    i would like have 3 dropdown that show the child categories and work with a single submit button

    Anybody can help me, please?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I did not know the name of your third category, so I created this code with two dropdowns. You should be able to add the third yourself.

    <script type="text/javascript">
       function validateForm() {
          var tipo = document.getElementById('tipo').value;
          var producto = document.getElementById('producto').value;
          var catForm = document.getElementById('catForm'); // retrieve form
          catForm.action = catForm.action + '?cat=' + tipo + ',' + producto; // add cat parameter
          var retval = true;
          retval = confirm("action=" + catForm.action);  // For testing, comment out for production
          return retval;
    <h2><?php _e('Categories:'); ?></h2><br>
    <form id="catForm" action="<?php bloginfo('url'); ?>" method="post"
       onSubmit="return validateForm();">
          <?php wp_dropdown_categories('show_option_none=Selecciona el tipo&child_of=78&id=tipo&name=tipo'); ?>
          <?php wp_dropdown_categories('show_option_none=Selecciona el producto&child_of=65&id=producto&name=producto'); ?>
          <input type="submit" id="sub" name="submit" value="view" />

    Hello vtxyzzy.

    Thank you so much!!!! Your code really helped me a lot.
    I can see now that javascript function, did all work.

    I began work on my first theme with WP codex, therefore i learned something new with your help.


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How configure multiple dropdown with submit button’ is closed to new replies.