I have a preg_match_all created so that I can validate my input in a form, which I only requires number (0-9), alphabets (a-z or A - Z) and the dash (-).
Code: Select all
if(preg_match_all('/[^a-z0-9-]/i', $db_marinanumber, $invalid))
{
$errors[] = "Your Marina license number contains invalid character: " . join('',array_unique($invalid[0]));
}I still get the errors and the errors says blank a whitespace character. But I don't have any on that in my input. Why is that?