In article <002e01c0e46c$ec2459a0$6e00a8c0@webdesign>,
[EMAIL PROTECTED] ("Jay Paulson") wrote:
> echo ereg("^[a-zA-Z]$", $fname);
>
> as you can see I'm just looking to make sure the variable $fname just has
> characters a-zA-Z and nothing else.
Actually, you're checking whethere the variable is a single-character
string a-zA-Z. For what you want:
ereg("^[a-zA-Z]+$", $fname); //add plus sign
Note also that although the docs imply that ereg() returns an integer
value, it says further down "Returns true if a match for pattern was found
in string, or false if no matches were found or an error occurred." In my
experience, boolean values don't echo well. Try this instead:
if(ereg("^[a-zA-Z]+$", $fname))
{
echo "<p>Passed!</p>\n";
}
else
{
echo "<p>Failed. Enter a different value.</p>\n";
}
--
CC
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]