March 14, 201016 yr Hello friends, i need my telephone field of my form to accept only numbers and not alphabets & other characters, how do i do that? regards
March 14, 201016 yr Hello friends, i need my telephone field of my form to accept only numbers and not alphabets & other characters, how do i do that? regards This is what I used:- # elseif(eregi('[^][0-9]' , $rating)) # {echo "<p>Please only use numbers 0 to 9 inclusive.<br>Use your back button to <span style=\"color: red;\">try again</span>.</p>";} The elseif may be different, it depends on the format of your PHP code. [^] means NOT so it's checking if the input is not a number, if so, it shows the error text. I also see that eregi is deprecated http://php.net/manual/en/function.eregi.php but is still useable until PHP 6 (not released yet) when another function will have to be used (but I'm not sure which).
March 16, 201016 yr I also see that eregi is deprecated http://php.net/manual/en/function.eregi.php but is still useable until PHP 6 (not released yet) when another function will have to be used (but I'm not sure which). preg_match() http://php.net/manual/en/function.preg-match.php
Create an account or sign in to comment