title: Check if input field value exist in array, if so return to page with an error
body: <p>I have a form where user insert their names, once they submit the form, the page should check if the name provided already exists, if so, should return with an error, other wise, proceed normally.</p>
  
  <p>How do I check if my input value exists and stop the form if this exists?</p>
  
  <pre><code>&lt;?php
  
  $array = get_meta_values( 'user_submit_name' );
  // Array to search:
  // Temp array so we don't find the same key multipule times:
  $temp = array();
  // Iterate through the array:
  foreach ($array as $key)
  {
  // Check the key hasn't already been found:
  if (!in_array($key, $temp))
  {
      // Get an array of all the positions of the key:
      $keys = array_keys($array, $key);
      // Check if there is more than one position:
      if (count($keys)&gt;0)
      {
          // Add the key to the temp array so its not found again:
          $temp[] = $key;
          // Do something...
          echo '&lt;li&gt;Name already used';                        
      }
  }
  }
  ?&gt;
  </code></pre>
  
  <p>html</p>
  
  <pre><code>&lt;form class="form-horizontal" role="form" id="usp_form" method="post" data-validate="parsley" enctype="multipart/form-data" novalidate&gt;
  
          &lt;div class="form-group"&gt;
              &lt;label  class="col-lg-2 control-label" for="user-submitted-name"&gt;Il tuo nome&lt;/label&gt;
               &lt;div class="col-lg-10"&gt;
                  &lt;input name="user-submitted-name" type="text" value="" data-required="true" required placeholder="Your name" class="form-control input-lg usp-input"&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
           &lt;div class="col-lg-offset-2 col-lg-10"&gt;
              &lt;input class="submit btn btn-lg btn-primary" name="user-submitted-post" id="user-submitted-post" type="submit" value="&lt;?php _e('Submit', 'usp'); ?&gt;"&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>