some help please

php Malaysia
  • 13 years ago
    hey guys.. need help..
    1) how do i set a validation for a text field to specificly recieve numeric values only.?? i tried the is_nan but didnt work ..maybe i did not use it correctly...im not sure though...

    2)how do i split a text from a alphanumeric value?

    thanks in advance guys.






  • 13 years ago
    1) use is_numeric($value) instead of is_nan($value)
    if(is_numeric($value)){
        //is a number
    }
    else{
        //is not a number
    }

    /*valid numbers
    "200" //positive
    "-200" //negative
    "  200" //string (even with a space first)
    "200.01"//decimal
    ".01"//=0.01
    "2e10" //scientific notation
    "0xFF"//hex notation (without sign, decimal, exponential parts)
    */















Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone” - Bjarne Stroustrup