craigbabe Posted April 13, 2006 Share Posted April 13, 2006 hey I have a site where you can bet on things. But people are cheating in some scripts by betting 100% or 100* or something like that..If it was called $bet = 100* ;how can I alter the string so it only outputs the 100 and not the * ? Quote Link to comment Share on other sites More sharing options...
toplay Posted April 13, 2006 Share Posted April 13, 2006 You can use ereg and preg functions but the simplest to validate input is a numeric integer is to use:[a href=\"http://us2.php.net/manual/en/function.ctype-digit.php\" target=\"_blank\"]http://us2.php.net/manual/en/function.ctype-digit.php[/a] Quote Link to comment Share on other sites More sharing options...
craigbabe Posted April 13, 2006 Author Share Posted April 13, 2006 So this should work for characters like Â? if (!ctype_digit($price)) {exit; } 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.