I have the following function called within a large PHP script. All this function does, is it checks to see if any special character(s) have been submitted in a form. If a special character has been submitted, than an error message is sent to the user to fix their form entry. Right now, this script works find and it filters ALL special characters. I would like to allow the the period symbol to come through the from while continuing to block all other characters. Can someone help with this?
Thanks for your time.
Code:
function check_domain($dname) {
global $errormsg, $text_17, $text_18, $text_19, $minlength, $maxlength, $reserved;
// Check if special chars are in there
if(ereg("[^a-zA-Z0-9\-]",$dname)) {
$errormsg = "$text_19<br>";
}
return $errormsg;
}
Thanks for your time.