Reputation: 260
I entered my flyer id as abc
in input and stored it in $flyerIDs
.
I want to validate that input does not contain anything except spaces, digits and comma and if it does throw error.
I have:
$error = preg_match("/[^\s,0-9]+/gi", $flyerIDs);
$error
stores "". Don't understand why.
Upvotes: 0
Views: 59
Reputation: 396
I don't think "g" is a valid modifier in PHP. Also, "i" would only be needed if matching letters.
$error = preg_match("/[^\s,0-9]+/", $ids);
Upvotes: 3