title: How to pass a value of selected option in one file to functions.php
body: <p>I have a dropdown on home page whose value i want to use in a function in functions.php How should i proceed i have no idea. This is the code i am using</p>
  
  <pre><code>&lt;form action="single-product.php" method="POST"&gt;
            &lt;select name="selected-country" id="country-opt"&gt;
              &lt;option selected="true" disabled="disabled"&gt;Choose Your Country&lt;/option&gt;
              &lt;?php
                  $args = array( 'post_type' =&gt; 'product',                             
                                 'posts_per_page' =&gt; 4,                           
                               );
                  $loop = new WP_Query( $args );
                  if($loop-&gt;have_posts()):while($loop-&gt;have_posts()):$loop-&gt;the_post();               
  
                  $term  = wp_get_post_terms($post-&gt;ID,'product_cat');             
  
              ?&gt;
  
  
              &lt;option  value="&lt;?php echo $term[0]-&gt;name; ?&gt;" href="&lt;?php the_permalink();?&gt;"&gt;&lt;?php echo $term[0]-&gt;name; ?&gt;&lt;/option&gt;
              &lt;?php 
                  endwhile;
                  endif;
              ?&gt;
            &lt;/select&gt; 
        &lt;/form&gt;
  
  &lt;a id="submit-btn" href=""&gt;Submit&lt;/a&gt;
  
  &lt;script&gt;
          document.getElementById("country-opt").onchange = function() {
              if (this.selectedIndex!==0) {
                 document.getElementById("submit-btn").href=this.children[this.selectedIndex].getAttribute('href');
              }        
          };       
  &lt;/script&gt;
  </code></pre>