title: Check if user input matches array of values. PHP
body: <p>I have one field (for zip code), if user enters zip code that matches one in my array and click "go" - they are redirected to the next step, if not - display "out of our service area" message. Form and php script are on the same page. How Do I do redirection inside  That's what I have so far.</p>
  
  <pre><code>     &lt;form&gt;
  &lt;input type="text" id="zipcode" name="zipcode" /&gt;
  &lt;input type="submit" id="submit" value="GO" /&gt;
  &lt;/form&gt;
  &lt;?php 
  $allowedzips = array("10051", "10061", "10071", "10081");
  $input = echo $_POST["zipcode"];
  $input = str_split($input);
  $message = "Out of our service area";
  foreach($input as $zip) {
      if (in_array($zip, $allowedzips)) {
          $message //redirect goes here
          break;
      }
  }
  echo $message;
  
  ?&gt;
  </code></pre>