shotza Posted January 10, 2007 Share Posted January 10, 2007 Hi folksI'm very new at php and writing code in general so please be gentle with me :)I'm trying to write an if statement that will check for numeric input unfortunatley the code isnt trapping any text input. The statement is as follows: if (!preg_match('/[[:^digit:]]/', $seconds)) { echo "<h1>Laptime must contain numeric values only! </h1> <p>Please hit the <b>Back Button</b> on your browser to re-enter information"; exit(); }#end ifAny pointing out of stupid mistakes would be greatly appreciated! Quote Link to comment Share on other sites More sharing options...
effigy Posted January 10, 2007 Share Posted January 10, 2007 POSIX bracket-expressions are not valid in PCRE; try [tt]/^\d+$/[/tt] to match all digits. Quote Link to comment Share on other sites More sharing options...
shotza Posted January 10, 2007 Author Share Posted January 10, 2007 That worked a treat - very much appreciated :) 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.