title: How to Add a Selected Option Value to Search Query
body: <p>So you can check out the search on my site at <a href="http://www.CyberBytesInc.com" rel="nofollow">http://www.CyberBytesInc.com</a> it's working just fine at the moment. What I am trying to do though is I have a search parameter dropdown next to the search, one "Search Entire Site" and the other "Search Blog". I am using Google Custom Search so to search just my blog all I need to have before the search term is "site:cyberbytesinc.com/blog/" aka, the value of the dropdown.</p>
  
  <p>Here's the HTML:</p>
  
  <pre><code>&lt;div id="search" class="hidden"&gt;
    &lt;form method="get" action="/search" class="row no-p-mobile"&gt;
      &lt;select id="search-parameter" name="parameter"&gt;
        &lt;option value=""&gt;Search Entire Site&lt;/option&gt;
        &lt;option value="site:cyberbytesinc.com/blog/"&gt;Search Blog&lt;/option&gt;
      &lt;/select&gt;
      &lt;input id="search-field" name="q" type="search" placeholder="Enter to Search"/&gt;
      &lt;span class="visible-desktop"&gt;&lt;input class="red-btn" type="submit" value="Search ›"&gt;&lt;/span&gt;
      &lt;!-- x-webkit-speech --&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Pretty much if they leave it on "Search Entire Site" which is the default, then I want it to do just as it already does, so I have the value set to nothing. But if they select "Search Blog" then I want them to type in their search query next to it, and upon hitting enter, it would just take the value of the option they selected and throw it into the URL right before their search term, so it would go from:</p>
  
  <pre><code>.com/search?q=example
  </code></pre>
  
  <p>to</p>
  
  <pre><code>.com/search?q=site:cyberbytesinc.com/blog/%20example
  </code></pre>
  
  <p>I know this has to be very straightforward, I am just pretty new with all of this and have spent a bit trying to figure it out on my own and I'm at the point where I could just use some quick help!</p>
  
  <p>Thanks so much guys/gals (:</p>
  
  <p><strong>EDIT (I'm VERY Close now, Just Need A Little Help):</strong></p>
  
  <p>I have tried numerous things, for instance, naming both the option and the textfield the same name, e.g. "q" and I have managed the url to become this when searching just the blog:</p>
  
  <pre><code>.com/search?q=site%3Acyberbytesinc.com%2Fblog%2F+&amp;q=example
  </code></pre>
  
  <p>So it's actually pulling in the proper things into the URL when selecting just the blog in the dropdown. The problem is, Google Custom Search is again just recognizing the last</p>
  
  <pre><code>"q=example"
  </code></pre>
  
  <p>and ignores the first </p>
  
  <pre><code>"q=site%3Acyberbytesinc.com%2Fblog%2F"
  </code></pre>
  
  <p>even though there is a + inbetween the two.</p>
  
  <p>If I could somehow get the term to carry over and not have the second "q=" then it would work, because it works perfectly if you just go in and remove the second "q=" in the URL structure it makes.</p>