I discovered the same thing, that all values from text fields ARE
text, i.e. strings. Also, that an empty field IS set upon return,
s...
To check for empty field, check for empty STRING equivalence:
if ( $input_var_from_form == "" ){
Do something because
To: [EMAIL PROTECTED]
Subject: RE: [PHP] how do i get a variable type? - not that simple
I discovered the same thing, that all values from text fields ARE
text, i.e. strings. Also, that an empty field IS set upon return,
s...
To check for empty field, check for empty STRING e
Very interesting! I'd think it would be a bug if it did work that way.
--
PHP General 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]
These are the functions I use to determine if
a string value is a valid integer, real, date, etc.
Hope this helps.
ps - please let me know if you find any errors. thanx.
?php
function IsValidBoolean($p) {
if ( isset($p) ) {
if ((strtolower($p) == "true") or
do i get a variable type? - not that simple
These are the functions I use to determine if
a string value is a valid integer, real, date, etc.
Hope this helps.
ps - please let me know if you find any errors. thanx.
?php
function IsValidBoolean($p) {
if ( isset($p
else print("is not a number");
}
?
Moody
-Original Message-
From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
Sent: 19 March 2001 15:55
To: [EMAIL PROTECTED]
Subject: RE: [PHP] how do i get a variable type? - not that simple
Jim,
Thanks for sharing all your hard work. Have you
How about a regex check for numeric characters with and without a decimal
point (and no leading zeros), versus alphanumerics? Just an "off the top of
my head suggestion", back to work...
Kirk
-Original Message-
""phpman"" [EMAIL PROTECTED] wrote in message
99132e$ol8$[EMAIL
I would right a function that would return a result and try an match within
the different types.
if (isdate($a))
{
Dtype = date;
}
if (isdigit($a))
{
Dtype = int;
}
return (Dtype);
etc..
At 01:44 PM 3/18/01 -0500, phpman wrote:
No guys. that doesn't work. Take this code for example...
Personally I'd perform a query into MySQL and get what _it_ thinks the
values should be ... before doing anything else. It allows generality in
your error checking code.
Look at mysql_list_fields() et al.
mark C.
- Original Message -
From: "phpman" [EMAIL PROTECTED]
To: [EMAIL
9 matches
Mail list logo