Jump to content

dde

Recommended Posts

I can't get the min and max range for the FILTER_VALIDATE_INT to work.

$subYoB = $_POST['yob'];

       $valYoB = array('option' => array('min_range' => 1900, 'max_range' => 2000));

       if(!filter_var($subYoB, FILTER_VALIDATE_INT, $valYoB))		
       {
            echo "Not valid";
       }
       else
       {
	    echo "Valid";
       }

Whenever the input of $_POST['yob'] is an INT it validates even when the input is lower the min_range, and higher than the max_range. What am I doing wrong?

I also tried this, without succes.

if(!filter_var($subYoB, FILTER_VALIDATE_INT, array('option' => array('min_range' => 1900, 'max_range' => 2000))))	
Link to comment
https://forums.phpfreaks.com/topic/293834-filter_validate/
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.