2 options:
Client Side via JavaScript... Best to post question in a JavaScript forum. This would validate immediately, either by limiting the field entry, or popup some alert or something if the wrong char is in it.
OR
Server Side via PHP. Regexp is needed. (This kind of validation would need to be done after the submission, and if the chars are there, either just dump them, or report an error to the user telling them to go back and make the corrections.
So first, you gotta decide which method you would prefer...