I'm working on a user sign-up script. Below are snippets from a form on Page One and the script on Page Two.
The ereg function below is supposed to approve 1). letters of the alphabet, 2). dashes, 3). periods, 3). single quote marks (as in $LastName = O'Neal), and white spaces. The input also has to be between two and twenty characters.
However, it's not working right: The script below rejects the single quote mark and gives the error message. I took the eregi() function below from a book. According to the book if the single quote mark is included within the allowable characters included in the eregi() function then the script should approve the single quote mark - but it won't.
[code=php]// Page One - form.
<form method="post" action="PageTwo.php">
<input type="text" name="LastName" size="15" maxlength="20"> Last Name<p>
</form>
// Page Two - Snippet from a user registration script.
// Rejects the single quote |'| mark below.
if (eregi ("^([[:alpha:]]|-|\.|'|[[:space:]]){2,20}$", $LastName)) {
$e = TRUE;
} else {
$ErrorMessage[] = "Please re-enter the last name field.<p>";
}[/code]
I would appreciate if anyone could spot the problem.
Thanks.
Volitics