I have an amount field which always is going to be positive number without decimal points like 10000, 1200, 10, 40 etc. I am using the code below to check for a valid amount.
if (!preg_match('/^[1-9][0-9]*$/', $_POST['amount'])) {
$error[] = 'Invalid amount';
}
Is it right. And, do i need to check for empty post amount using empty function of php separately or does above preg_match
also checks for empty string amount.