title: Form action changes when an option is selected
body: <p>When a user searches and selects one of the departments it must take them to that specific page. So if music is selected it must take them to the music page or dvd page but only when they click on the search button to submit the search.</p>
  
  <p>This is my form    </p>
  
  <pre><code>&lt;div id="form"&gt;
      &lt;form id="searchbarid" name="Searchbar"  action="Searchdefault.php" method="get"&gt;
         &lt;center&gt;
            Search
            &lt;input name="Search" type="text" dir="ltr" lang="en" size="50" /&gt;
            In &lt;select name="SearchBy" dir="ltr" lang="en" id="searchbyid"&gt;
                &lt;option value="All" selected="selected"&gt;All Departments&lt;/option&gt;
                &lt;option value="Music"&gt;Music&lt;/option&gt;
                &lt;option value="DVD"&gt;DVD's&lt;/option&gt;
                &lt;option value="Bluray"&gt;Bluray&lt;/option&gt;
            &lt;/select&gt;
            &lt;input type='submit' name="Submit" value="Search"/&gt;
          &lt;/center&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>Unfortunatly I have read this can be done with JavaScript and I know absolutly nothing about JavaScript. If JavaScript is the best way to do this please explain it to me.</p>
  
  <p>If it can be done with PHP I would be happier as I know more about PHP.</p>
  
  <p>EDIT:</p>
  
  <p>Ok so I tried the javascript and it didn't work</p>
  
  <p>This was in the head of my doc.</p>
  
  <pre><code>&lt;SCRIPT language="JavaScript"&gt;
      function goto(form) { 
          var index=form.select.selectedIndex
          if (form.select.options[index].value != "0") {
              location=form.select.options[index].value;}
          }
  &lt;/SCRIPT&gt;
  </code></pre>
  
  <p>And this was My search (Note I only changed the value of Music to see if it would work)</p>
  
  <pre><code>&lt;div id="form"&gt;
      &lt;form name="Searchbar" &gt;
  
      &lt;center&gt;
  
    Search
  &lt;input name="Search" type="text" dir="ltr" lang="en" size="50" /&gt;
  
  
        In &lt;select name="SearchBy" dir="ltr" lang="en" id="searchbyid" onchange="goto(this.form)" &gt;
            &lt;option value="All" selected="selected"&gt;All Departments&lt;/option&gt;
            &lt;option value="/Echos Online/Music.php"&gt;Music&lt;/option&gt;
            &lt;option value="DVD"&gt;DVD's&lt;/option&gt;
            &lt;option value="Bluray"&gt;Bluray&lt;/option&gt;
          &lt;/select&gt;
    &lt;input type='submit' name="Submit" value="Search" /&gt;
  
      &lt;/center&gt;
      &lt;/form&gt;
  
   &lt;/div&gt;
  </code></pre>
  
  <p>Can Someone please piont out what I'm doing wrong</p>
  
  <p>Many Thanks to everyone so far for there help and any more help will be greatly apprieciated</p>