Re: [PHP] Forms and PHP variables

2002-12-22 Thread Jason Wong
On Sunday 22 December 2002 10:29, Beauford.2002 wrote:
 Hi,

 First off, thanks to all those that helped out with my other questions. Not
 all my problems were solved, but I'm certainly closer. Still working on the
 same project I need to do the following.

 I have a form where users input numbers only, is there a way I can have php
 check to make sure a letter or other character didn't get put in by
 accident. I was looking at ereg, but not to familiar with this or if it
 would work in this case.

Try this:

  http://www.phpclasses.org/browse.html/package/914.html

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
So this is what it feels like to be potato salad
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Forms and PHP variables

2002-12-22 Thread Philip Olson

is_numeric() will work with variables just fine. So:

  if (is_numeric($var)) {
  print Yep, it's numeric;
  } else {
  print Nope, it sure isn't a number;
  }

Make sure $var is defined.  If it's coming from a
form then use $_POST['var'] or similar instead for
reasons described here:

  http://www.php.net/variables.external

Regards,
Philip Olson

On Sat, 21 Dec 2002, Beauford.2002 wrote:

 Thanks for the info, but . is_numeric does not appear to accept
 variables  i.e. is_numeric($num) and ctype gives me the following.
 
 Fatal error: Call to undefined function: ctype_digit() in
 /usr/local/apache/htdocs/.. on line 6
 
 
 
 
 - Original Message -
 From: Philip Olson [EMAIL PROTECTED]
 To: Beauford.2002 [EMAIL PROTECTED]
 Cc: PHP General [EMAIL PROTECTED]
 Sent: Saturday, December 21, 2002 9:50 PM
 Subject: Re: [PHP] Forms and PHP variables
 
 
 
  Use is_numeric()
 
http://www.php.net/is_numeric
 
  See also the ctype functions which can
  be read about here:
 
http://www.php.net/ctype
 
  And yes, regular expressions are another
  option but aren't needed here.
 
  Regards,
  Philip Olson
 
 
  On Sat, 21 Dec 2002, Beauford.2002 wrote:
 
   Hi,
  
   First off, thanks to all those that helped out with my other questions.
 Not
   all my problems were solved, but I'm certainly closer. Still working on
 the
   same project I need to do the following.
  
   I have a form where users input numbers only, is there a way I can have
 php
   check to make sure a letter or other character didn't get put in by
   accident. I was looking at ereg, but not to familiar with this or if it
   would work in this case.
  
   TIA
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Forms and PHP variables

2002-12-21 Thread Beauford.2002
Hi,

First off, thanks to all those that helped out with my other questions. Not
all my problems were solved, but I'm certainly closer. Still working on the
same project I need to do the following.

I have a form where users input numbers only, is there a way I can have php
check to make sure a letter or other character didn't get put in by
accident. I was looking at ereg, but not to familiar with this or if it
would work in this case.

TIA



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Forms and PHP variables

2002-12-21 Thread Philip Olson

Use is_numeric()

  http://www.php.net/is_numeric

See also the ctype functions which can
be read about here:

  http://www.php.net/ctype

And yes, regular expressions are another
option but aren't needed here.

Regards,
Philip Olson


On Sat, 21 Dec 2002, Beauford.2002 wrote:

 Hi,
 
 First off, thanks to all those that helped out with my other questions. Not
 all my problems were solved, but I'm certainly closer. Still working on the
 same project I need to do the following.
 
 I have a form where users input numbers only, is there a way I can have php
 check to make sure a letter or other character didn't get put in by
 accident. I was looking at ereg, but not to familiar with this or if it
 would work in this case.
 
 TIA
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Forms and PHP variables

2002-12-21 Thread Beauford.2002
Thanks for the info, but . is_numeric does not appear to accept
variables  i.e. is_numeric($num) and ctype gives me the following.

Fatal error: Call to undefined function: ctype_digit() in
/usr/local/apache/htdocs/.. on line 6




- Original Message -
From: Philip Olson [EMAIL PROTECTED]
To: Beauford.2002 [EMAIL PROTECTED]
Cc: PHP General [EMAIL PROTECTED]
Sent: Saturday, December 21, 2002 9:50 PM
Subject: Re: [PHP] Forms and PHP variables



 Use is_numeric()

   http://www.php.net/is_numeric

 See also the ctype functions which can
 be read about here:

   http://www.php.net/ctype

 And yes, regular expressions are another
 option but aren't needed here.

 Regards,
 Philip Olson


 On Sat, 21 Dec 2002, Beauford.2002 wrote:

  Hi,
 
  First off, thanks to all those that helped out with my other questions.
Not
  all my problems were solved, but I'm certainly closer. Still working on
the
  same project I need to do the following.
 
  I have a form where users input numbers only, is there a way I can have
php
  check to make sure a letter or other character didn't get put in by
  accident. I was looking at ereg, but not to familiar with this or if it
  would work in this case.
 
  TIA
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php