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.
So this is my code to generate the form:
$fields = array(
array(
'label' => 'Name:',
'id' => $meta.'_nhm_lead_name',
'class' => 'field-name input', // optional
'wrapper_class' => 'four columns', // optional
'type' => 'text',
'required' => true,
),
)
and this is how I generate the html:
public function make_fields(){
foreach($this->fields as $field => $value){
switch ($value['type']) {
case 'text':
$inputs .= '<li class="field '.$value['wrapper_class'].'">';
$inputs .= '<input type="text" name="'.$value['id'].'" class="'.$value['class'].'" />';
$inputs .= '<span class="error-message"></span>';
$inputs .= '</li>';
break;
}
}
}