Re: Validating user input
| From: | Misha Peric | Date: | Thu, 05 Jun 2003 18:37:25 +0000 |
| Subject: | Re: Validating user input | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-150398@lists.php.net to get a copy of this message | ||
Try this:
if (is_numeric($txt1) && (float)$txt1<24 &&
(strlen($txt1)-strpos($txt1,"."))<=3) {
echo "True";
}
else {
echo "False";
};
Misha
PHP Genie
"Electroteque" <daniel@electroteque.org> wrote in message
news:EJECKPELDLGDPHHJOEDLMEGOFCAA.daniel@electroteque.org...
> is_numeric and strlen ?
>
> -----Original Message-----
> From: Shaun [mailto:shaun@mania.plus.com]
> Sent: Tuesday, June 03, 2003 7:21 PM
> To: php-general@lists.php.net
> Subject: [PHP] Validating user input
>
>
> Hi,
>
> I am creating a timesheet application, how can I make sure that a user has
> entered a number, and that the number is a whole number or a decimal up to
2
> places, and that the number is less than 24?
>
> Thanks for your help
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>