Jump to content

Integer Max Value


AndyXS

Recommended Posts

This script should not allow $rating to be more than 10, yet for some reason its not working.

 

Any ideas?

 

 

 

if ($_GET['rating'] != "") {   
  $min = 1;
  $max = 10;
  $rating = filter_var($_REQUEST['rating'], FILTER_VALIDATE_INT, array("min_range"=>$min, "max_range"=>$max)); 
  if ($rating == "") {   
    $errors .= 'Invalid Rating.<br /><br />';   
  }   
} else {   
  $errors .= 'Invalid Rating.<br />';   
}

Link to comment
https://forums.phpfreaks.com/topic/180053-integer-max-value/
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.