i know that one condition that im currently using where it gives an error if $stringabc contains anything but numbers is :
if(preg_match("/[^0-9]/",$stringabc))
I want an if condition where it gives an error if $stringdef contains anything but letters, spaces and dashes (-).
That would be:
for “anything but letters (a-z), spaces (\s, meaning any kind of whitespace), and dashes (-)”.
To also allow numbers: