format($format) == $date; } function checkValue($id,$idx){ if($idx==1){ if($_POST[$id]!=""){ if(strlen($_POST[$id])!=1){ $jsone['result'] = "Fail"; $jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric"; echo json_encode($jsone); exit; } if(!ereg("[0-9]",$_POST[$id])){ $jsone['result'] = "Fail"; $jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric"; echo json_encode($jsone); exit; } } } if($idx==2){ if($_POST[$id]!=""){ if(strlen($_POST[$id])>2){ $jsone['result'] = "Fail"; $jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric"; echo json_encode($jsone); exit; } if(!ereg("[0-9]",$_POST[$id]) & !ereg("[0-9]{2}",$_POST[$id])){ $jsone['result'] = "Fail"; $jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric"; echo json_encode($jsone); exit; } } } } ?>