Jump to content

[SOLVED] Php Number Validation


elabuwa

Recommended Posts

Hey guys,

 

Probably one of the easiest questions ever asked.

What is the function you use to validate if a variable is numeric is or not.

 

This function must treat values with decimals as numbers.

I tried is_numeric, c_type(digit) or some thing like that with no luck.

 

I tried this below code found in the net.

 

If (validate_numeric($total_received)){

echo "Please Enter A Numeric Value For The Total Received";

    exit;

}

 

I ended up getting the below error.

 

Fatal error: Call to undefined function validate_numeric() in C:\wamp\www\myacc\receipts\process.php on line 47

 

So i thought that there is an easier already built in function that im missing.

can you please help me out.

thanks in advance.

 

Link to comment
https://forums.phpfreaks.com/topic/176689-solved-php-number-validation/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.