ChambeRFienD Posted August 29, 2006 Share Posted August 29, 2006 Hello, I'd like to write a script to only accept numbers that are multiples of 25, starting at 100 and ending at 50,000...So if they select something lower than 100 they get an error, something higher than 50,000 they get an error, and if they enter something like 101, it will round it to 125.. I'm sure I could do this with a select(), but it would be an extreme pain to do that for every 25 all the way up to 50,000...To clear things up:If they enter 101 in the field, it will round it to 125. If they ender 24,142 it will round to 24,150.. Anyone know a way to do this? Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 29, 2006 Share Posted August 29, 2006 [code]<?phpif ($thing><100) { echo "an error";} else { $newthing = 25*ceil($thing/25); // result .... any other code ...}?>[/code] Quote Link to comment Share on other sites More sharing options...
ChambeRFienD Posted August 29, 2006 Author Share Posted August 29, 2006 [quote author=AndyB link=topic=106144.msg424269#msg424269 date=1156886321][code]<?phpif ($thing><100) { echo "an error";} else { $newthing = 25*ceil($thing/25); // result .... any other code ...}?>[/code][/quote]Thanks much! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.