I'm trying to validate some user entered text, and I'm using the code below:
Now if I enter the text :"John"..the text is accepted as it should be.
Also if I just enter symbols such as or numbers...it gives the appropriate error message.
The issue at hand is that if I were to enter something like "<john>" it also accepts the text. How can I fix this?
Code:
$last_name = trim($_POST[‘last_name’]);
if ( !ereg(“[A-Za-z’ -]{1,50}”,$last_name)
{
do stuff to require user to reenter last name;
}
Also if I just enter symbols such as or numbers...it gives the appropriate error message.
The issue at hand is that if I were to enter something like "<john>" it also accepts the text. How can I fix this?
Comment