Thanks Steve,

It is not my choice re javascript in this case

I have tried to use the functions is_int($input_var) and
is_integer($input_var)  and the !versions as you suggest but with
failures.

____Example 1_____

if ((@!$submit) || (!is_int($input_var)) )
  {
   echo "error";
   include "get_id.php";
   }

else {
________

_____Example 2_____

if ((@!$submit))
  {
   echo "error";
   include "get_id.php";
   }

elseif (is_int($num)) {
_____________

There were no problems before attempting validation with is_int() and
is_integer().  The integer validation was being with a javascript and
the creation of the variable was OK.

Further advise appreciated.

Tim




----- Original Message -----
From: Steve Farmer <[EMAIL PROTECTED]>
To: boclair <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, April 05, 2001 3:23 PM
Subject: Re: [PHP-DB] Forms : Validating user input is integer


> Hi tim,
>
> most certainly it can be done on the server side, it juts requires a
> round trip to the server is all....
>
> i think it is ..
>
> if(!isinteger($input_var)): (check the exact function in the php
manual)
>   echo "this is an error (or whatever), press here to go back and
> correct your inpout";
> exit; /* stops the script executing */
> endif;
>
> HTH
> Steve
>
> At 3:05 PM +1000 5/4/01, boclair wrote:
> >I have a problem with a user input in a form required to be an
> >integer, creating a variable for a mysql query.
> >
> >I have instances where integer, 0, is being typed as letter,o.
> >
> >The last discussion of validating the input was
> >http://marc.theaimsgroup.com/?l=php-db&m=97207172003983&w=2
> >
> >There it was suggested that the only way to validate the input was
> >using javascript.  I have a case where clients have disabled
> >javascript.
> >
> >I tried fiddling with is_int($input) but of cause it does not serve
> >this purpose.
> >
> >Does anybody know if such validation can be done server side or
> >definitely must be done client side?
> >
> >Tim Morris
> >
> >
> >
> >
> >--
> >PHP Database 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]
>
> --
> ---------------------------------------------------
> "Minds are like parachutes, they work best when open"
> Support free speech; visit http://www.efa.org.au/
>
> Heads Together Systems Pty Ltd http://www.hts.com.au
> Email: [EMAIL PROTECTED]     Tel: 612 9982 6767     Fax: 612 9981 3081
>
> --
> PHP Database 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]
>
>


-- 
PHP Database 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]

Reply via email to