Need a way to validate an input field (in PHP) so it can contain only the following:
- Any letter
- Any number
- any of these symbols: - (dash) _ (underscore) @ (at) . (dot) or a SPACE
Field can start or end with any of these (but not a space, but I can trim it before passing into validation function), and contain none, one, or any number (so just a check to make sure everything in the input is one of the above).
I would like to be able to do something like this:
funcion is_valid ( $in_form_input ) {
// returns true or false
}
if ( is_valid($_POST['field1']) ) {
echo "valid";
} else {
echo "not valid";
}