The ereg function doesn't have the capability to test the age of the
person viewing your page. You have to depend on them to input their
age in some way.
Your answer depends on how your age is submitted. Assuming it is
submited as $_POST['age'], you could perhaps use ereg("0*[7-9]$",
$_POST['age']
Numbers are pretty easy. You could just do:
$age = (int)$_POST['age'];
if($age > 9) do_something();
else do_something_else();
Using ereg doesn't make much sense in this case.
-Rasmus
On Fri, 31 Dec 2004, Michael Lutaaya wrote:
> I want to validate someones age. How do I do this in
>
I want to validate someones age. How do I do this in
the ereg function.
I also have some visitors on my site who are in
between the ages of 7-9 so don't forget to make them
part of the ereg function.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsu
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 variabl
hello-
I have a pretty easy question for some of you. I'm using the ereg function and it's
not returning a true or false after it runs. Below is the code snippet I'm using.
echo ereg("^[a-zA-Z]$", $fname);
as you can see I'm just looking to make sure the variable $fname just has characters
a
5 matches
Mail list logo