title: PHP check input type for validation
body: <p>I'm wondering if there is a way to check what type of input was used for $_POST information. I want to then use that type for validation. For instance, if an input type="text" then I would want to be able to create certain validations for that type of input.</p>
  
  <p>So this is my code to generate the form:</p>
  
  <pre><code>$fields = array(
      array(
          'label' =&gt; 'Name:',
          'id' =&gt; $meta.'_nhm_lead_name',
          'class' =&gt; 'field-name input', // optional
          'wrapper_class' =&gt; 'four columns', // optional
          'type' =&gt; 'text',
          'required' =&gt; true,
      ),
  )
  </code></pre>
  
  <p>and this is how I generate the html:</p>
  
  <pre><code>    public function make_fields(){
      foreach($this-&gt;fields as $field =&gt; $value){
          switch ($value['type']) {
              case 'text':
                  $inputs .= '&lt;li class="field '.$value['wrapper_class'].'"&gt;';
                  $inputs .= '&lt;input type="text" name="'.$value['id'].'" class="'.$value['class'].'" /&gt;';
                  $inputs .= '&lt;span class="error-message"&gt;&lt;/span&gt;';
                  $inputs .= '&lt;/li&gt;';
              break;
           }
       } 
       }
  </code></pre>