title: Form choice direct to webpage
body: <p>Hi I am trying to get a form to route to a specified webpage based on chosen options. I have seen some answers on a previous thread by <a href="https://stackoverflow.com/users/726326/dentaku">https://stackoverflow.com/users/726326/dentaku</a> but can't get it to work i've probably missed something simple. many thanks in advance</p>
  
  <pre><code>&lt;!---
  &lt;form&gt;
  &lt;p&gt; Type of Purchase: &lt;/p&gt;
  
  &lt;select id="type"&gt;
  &lt;option value="0" id="Select"&gt;Select&lt;/option&gt;
  &lt;option value="1" id="vaccation_rental"&gt;Vaccation Rental&lt;/option&gt;
  &lt;option value="2" id="purchase"&gt;Purchase&lt;/option&gt;
  &lt;option value="3" id="rental"&gt;Long Term Rental&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;p&gt;Type of Property&lt;/p&gt;
  &lt;select id="property"&gt;
  &lt;option value="0" id="Select"&gt;Select&lt;/option&gt;
  &lt;option value="1" id="Villa"&gt;Villa&lt;/option&gt;
  &lt;option value="2" id="Cabana"&gt;cabana&lt;/option&gt;
  
  &lt;/select&gt;
  
  &lt;br /&gt;&lt;br /&gt;
  
   &lt;input  onclick="goToPage();"  type="button" value="Submit" /&gt; 
   &lt;/form&gt;
  
   &lt;script type="text/javascript"&gt;
  
  function goToPage()
  {
  
  
  &lt;script&gt;
  var targetURL;
  if (type==0) {
  switch (property) {
      case 1: targetURL = "http://www.mysite.com/index.html";
      case 2: targetURL = "http://www.mysite.com/index.html";
      case 3: targetURL = "http://www.mysite.com/index.html";
  }
  } else if (type==1) {
  switch (property) {
      case 1: targetURL = "http://www.mysite.com/Rental.html";
      case 2: targetURL = "http://www.mysite.com/VRental_villa.html";
      case 3: targetURL = "http://www.mysite.com/VRental_cabana.html";
  
  }
  } else if (type==2) {
  switch (property) {
      case 1: targetURL = "http://www.mysite.com/Buying.html";
      case 2: targetURL = "http://www.mysite.com/Buying_villa.html";
      case 2: targetURL = "http://www.mysite.com/Buying_cabana.html";
  }
  } else {
  switch (property) {
      case 1: targetURL = "http://www.mysite.com/Rental.html";
      case 2: targetURL = "http://www.mysite.com/Rental_villa.html";
      case 3: targetURL = "http://www.mysite.com/Rental_cabana.html";
  }
  }
  targetURL ? window.location.href = targetURL : alert("Type of Property.");&lt;/script&gt;  
  &lt;!-- end .content --&gt;&lt;/div&gt;
  &lt;!-- end .container --&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>