I am using the following function for basic text fields on my form. I have looked up the ereg function and haven't been able to figure out the A-Za-z0-9 stuff too well. How do I allow the following entries to be made, yet have my system still safe from injections? Should I be using addslashes rather than this function?
desired entry examples:
1) first-run
2) O'Reiley
Thanks.
// Validate text only
function validateTextOnly($theinput,$description = ''){
$result = ereg ("^[A-Za-z0-9\ ]+$", $theinput );
if ($result){
return true;
}else{
$this->errors[] = $description;
return false;
}
}