On Thu, 2003-10-23 at 11:51, Robert Cummings wrote:
> On Thu, 2003-10-23 at 11:21, Cesar Cordovez wrote:
> >
> > At this point, I think I have to change the procedure. This is not
> > good. Any sugestions on how to now if the user types an integer number
> > in a field?
> >
>
> Here's a really simple way:
>
> if( ereg( '^[[:space:]]*[[:digit:]]+[[:space:]]*', $input ) )
> {
> // Yaaaaaaay, integer input!
> }
Whoops, forgot the trailing $
if( ereg( '^[[:space:]]*[[:digit:]]+[[:space:]]*$', $input ) )
{
// Yaaaaaaay, integer input!
}
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php