title: How to make a simple JavaScript redirection based on submitted form value?
body: <p>I want to define 4 arrays with specific postal codes for each location, and then based on a postal code (value of a user-submitted form) I want to redirect user to a new location.</p>
  <p>I have no idea what I am doing wrong (I am not a coder).</p>
  <p>I am trying to do something like this, but it doesn't work:</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;script&gt;
  function sprawdzKody() {
  
  const mokotow = [&quot;00-807&quot;, &quot;00-808&quot;, &quot;00-809&quot;];
  const ursynow = [&quot;01-807&quot;, &quot;01-808&quot;, &quot;01-809&quot;];
  const targowek = [&quot;02-807&quot;, &quot;02-808&quot;, &quot;02-809&quot;];
  const wesola = [&quot;03-807&quot;, &quot;03-808&quot;, &quot;03-809&quot;];
  
  var kodPocztowy = document.getElementById(&quot;kodPocztowy&quot;).value;
  
  if(mokotow.includes(kodPocztowy)){ 
     window.location.href = &quot;https://mokotow.geishasushi.pl&quot;;
  } 
  else if(ursynow.includes(kodPocztowy)){ 
     window.location.href = &quot;https://ursynow.geishasushi.pl&quot;;
  } 
  else if(targowek.includes(kodPocztowy)){ 
     window.location.href = &quot;https://targowek.geishasushi.pl&quot;;
  } 
  else if(wesola.includes(kodPocztowy)){ 
     window.location.href = &quot;https://ursynow.geishasushi.pl&quot;;
  } 
  else { 
    window.location.href = &quot;http://geishasushi.pl/jestes-poza-rejonem&quot;;
  }
  }
  &lt;/script&gt;
  
  
  &lt;form onsubmit=&quot;return sprawdzKody();&quot; class=&quot;kod-pocztowy&quot;&gt;
      &lt;label for=&quot;kodPocztowy&quot;&gt; Kod Pocztowy&lt;/label&gt;&lt;br&gt;
      &lt;input type=&quot;text&quot; id=&quot;kodPocztowy&quot; name=&quot;kodPocztowy&quot;&gt;&lt;br&gt;
      &lt;input type=&quot;submit&quot; value=&quot;Znajdź Twoją restaurację&quot;&gt;
  &lt;/form&gt;
  </code></pre>