This is a discussion on PHP woes : checking if value is numeric within the Coding Help forums, part of the Webmaster Help category; I'm using this function from PHP: is_numeric - Manual PHP Code: function is_whole_number ( $var ){ return ( is_numeric ( ...
| |||||||
| Register | Forum Rules | FAQ | Donate | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||||
| I'm using this function from PHP: is_numeric - Manual PHP Code: I'm sure it's something obvious I am missing. Any hints ? Thanks ?
__________________ my sites : irish poker / irish jobs / seo faq / advertise jobs free / green card / skiing |
| |||||
| you do the isset() before calling the function PHP Code:
__________________ :. Web Design & Development Web Design Ireland :. Search Engines Optimization Search Engines Optimization :. Directory Submission Directory Submission :. News & Press Release Ireland GiveItSocks.com :. Used Cars Ireland, Car Parts & Car Audio Cars For Sale, Car Parts & Accessories :. I Have 2 Find It Directory SEF Directory |
| |||||
| Thanks Louie for the help Still having problems though PHP Code: I have an input box that I want people to either leave blank, or enter a numeral. Otherwise if they enter 'six' or something like that I want it to report the error. Last edited by paul; 22-02-2007 at 10:18 PM. Reason: more info |
| |||||
| don't get it. what format are you loonking to get from the visitor? like 6.00 or 6 give an example |
| |||||
| Hi Louie, I want to make sure that a user gives a whole decimal. The field is four characters long, and I am afraid some bright spark will enter 'five' instead of '5'. So only a whole number will do. No "two" "2,3" or "2.3" values should be accepted only 2. |
| |||||
| try this: PHP Code: |
| |||||
| Thanks mate. |
| |||||
| sorry about this I forgot to mention that if he enters a null value then that is okay. so logic Code: is NULL == okay proceed
is ! NULL
IS NUMERIC == okay proceed
IS NOT NUMERIC == give out error.
|
| |||||
| PHP Code: |
| |||||
| Cheers for your help louie and pointing me in the right direction. The problem was checking if something was NULL . I used PHP Code: |
| Tags |
| checking, numeric, php, woes |
| Thread Tools | |
| Display Modes | |
|
|
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP on windows | louie | Coding Help | 20 | 22-02-2006 06:25 PM |
| ||||||||
| | ![]() | |||||||