I want to check if value is other than integer and float, i have written form validation as follows,
$this->form_validation->set_rules('charge_hour', 'Per hour', 'xss_clean|callback_money_type');
$this->form_validation->set_rules('charge_day', 'Per day', 'xss_clean|callback_money_type');
$this->form_validation->set_rules('charge_weekly', 'Per week', 'xss_clean|callback_money_type');
$this->form_validation->set_rules('charge_monthly', 'Per month', 'xss_clean|callback_money_type');
and common call back function for all text filed is money_type()
public function money_type($charge)
{
if (is_float($charge) == false && is_int($charge) == false && $charge >= 0)
{
$this->form_validation->set_message('{WHAT TO ENTER HERE}', 'Enter valid charges for space.');
return FALSE;
}
else
{
return TRUE;
}
}
How can I find out during validation that {WHAT TO ENTER HERE}? field name is either of charge_hour, charge_day, charge_weekly, charge_monthly at runtime? so that form validation will show different error messages for each field.
Thanks.